annotate src/os_riscos.c @ 473:4a7320e53f32 v7.0126

updated for version 7.0126
author vimboss
date Wed, 10 Aug 2005 08:16:23 +0000
parents 3da34f87c760
children 07d199fe02ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 * os_riscos.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * Thomas Leonard <tal197@ecs.soton.ac.uk>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 const char *__dynamic_da_name = "Vim heap"; /* Enable and name our dynamic area */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 int ro_line_mode = TRUE; /* For Ex mode we much echo chars to the screen ourselves */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 int windowed; /* Flag - are we running inside a text window? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 int WinLeft, WinTop; /* We might be started inside a text window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 int ScrollTop; /* Make cursor movements relative to ScrollTop. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 int old_escape_state = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 int old_cursor_state = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #define rgb(r,g,b) ((b<<24) + (g<<16) + (r<<8))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 #define NORMAL_FG 0x00000000
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #define NORMAL_BG 0xffffffff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 /* Convert a DOS colour number to an RGB palette entry.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 * Mappings from X11 rgb/txt file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 map_colour(dos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 int dos; /* Standard DOS colour number. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 switch (dos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 case 0: return 0; /* Black */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 case 1: return rgb(0,0,139); /* DarkBlue */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 case 2: return rgb(0,100,0); /* DarkGreen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 case 3: return rgb(0,139,139); /* DarkCyan */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 case 4: return rgb(139,0,0); /* DarkRed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 case 5: return rgb(139,0,139); /* DarkMagenta */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 case 6: return rgb(165,42,42); /* Brown, DarkYellow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 case 7: return rgb(211,211,211); /* LightGray, LightGrey, Gray, Grey */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 case 8: return rgb(169,169,169); /* DarkGray, DarkGrey */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 case 9: return rgb(173,216,230); /* Blue, LightBlue */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 case 10: return rgb(144,238,144); /* Green, LightGreen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 case 11: return rgb(224,255,255); /* Cyan, LightCyan */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 case 12: return rgb(255,0,0); /* Red, LightRed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 case 13: return rgb(255,0,255); /* Magenta, LightMagenta */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 case 14: return rgb(255,255,0); /* Yellow, LightYellow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 case 15: return rgb(255,255,255); /* White */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 return rgb(100,100,100);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 text_fg(fg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 int fg; /* Foregound colour in the form &BBGGRR00 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 xswi(ColourTrans_SetTextColour, fg, 0, 0, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 text_bg(bg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 int bg; /* Backgound colour in the form &BBGGRR00 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 xswi(ColourTrans_SetTextColour, bg, 0, 0, 1 << 7);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 #define OUT_NORMAL 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 #define OUT_NUMBER 1 /* Reading in a number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 mch_write(s, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 static int mode = OUT_NORMAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 static int x, y; /* For reading numbers in. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 if (!term_console)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 /* Maybe we are running Vim remotely - don't interpret chars */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 while (len--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 char_u c = *s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 swi(OS_WriteC, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 /* We might need to send a CR too. This shouldn't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 * hurt if we don't need it, should it?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 if (c == 10)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 swi(OS_WriteI + 13);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 while (len--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 char_u c = *s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 switch (mode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 case OUT_NUMBER:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 if (c < '0' || c > '9')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 mode = OUT_NORMAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 x = (x * 10) + c - '0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 /* note: no break here! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 case OUT_NORMAL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 switch (c)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 case 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 /* Number (in decimal) follows. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 mode = OUT_NUMBER;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 y = x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 x = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 case 2:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 /* Position cursor. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 swi(OS_WriteI + 31);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 swi(OS_WriteC, x);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 swi(OS_WriteC, y - ScrollTop);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 case 3:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 /* Set scroll region. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 if (x == Rows -1 && y == 0 && !windowed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 /* Whole screen - remove text window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 * This is MUCH faster.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 swi(OS_WriteI + 26);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 /* Create a text window. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 swi(OS_WriteI + 28);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 swi(OS_WriteC, WinLeft);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 swi(OS_WriteC, WinTop + x);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 swi(OS_WriteC, WinLeft + Columns - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 swi(OS_WriteC, WinTop + y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 ScrollTop = y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 case 4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 /* Normal mode. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 text_fg(NORMAL_FG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 text_bg(NORMAL_BG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 case 5:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 /* Reverse mode. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 text_fg(NORMAL_BG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 text_bg(NORMAL_FG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 case 10:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 swi(OS_NewLine);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 case 14:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 /* Cursor invisible. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 swi(OS_WriteN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 "\027\001\000\000\000\000\000\000\000\000",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 10);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 case 15:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 /* Cursor visible. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 swi(OS_WriteN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 "\027\001\002\000\000\000\000\000\000\000",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 10);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 case 16:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 /* Cursor very visible (flash) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 swi(OS_WriteN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 "\027\001\003\000\000\000\000\000\000\000",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 10);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 case 17:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 /* Set foreground colour. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 text_fg(map_colour(x));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 case 18:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 /* Set background colour. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 text_bg(map_colour(x));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 case 19:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 /* Scroll text down. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 swi(OS_WriteN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 "\027\007\000\002\000\000\000\000\000\000",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 10);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 swi(OS_WriteC, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 printf("[output error]");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 mode = OUT_NORMAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 * mch_inchar(): low level input funcion.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 * Get a characters from the keyboard.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 * Return the number of characters that are available.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 * If wtime == 0 do not wait for characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 * If wtime == n wait n msecs for characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 * If wtime == -1 wait forever for characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 * TODO: call convert_input() for 'fileencoding' to 'encoding' conversion.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 mch_inchar(buf, maxlen, wtime, tb_change_cnt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 int maxlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 long wtime;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 int tb_change_cnt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 int got=0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 unsigned int start_time = clock();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 if (ro_line_mode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 /* We're probably in Ex mode - get whole lines at a time. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 static char_u line_buffer[256];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 static int remaining_chars = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 static int buf_pos = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 /* Do we need to fetch another line? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 if (remaining_chars == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 int old_esc_state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 swi(OS_Byte, 200, 1, 0xfe);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 old_esc_state = r1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 buf_pos = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 if (xswi(OS_ReadLine, line_buffer, 255, 0, 255) & (c_flag | v_flag))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 got_int = TRUE; /* ESC pressed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 r1 = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 line_buffer[r1] = 13;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 remaining_chars = r1 + 1; /* Count CR as part of input */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 swi(OS_Byte, 200, old_esc_state, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 /* Can we send the rest of the buffer back in one go? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 if (remaining_chars <= maxlen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 int got = remaining_chars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 memcpy(buf, line_buffer + buf_pos, got);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 remaining_chars = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 return got;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 /* Send as much as we can */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 memcpy(buf, line_buffer + buf_pos, maxlen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 buf_pos += maxlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 remaining_chars -= maxlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 return maxlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 if (!term_console)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 /* Use OS_ReadC for all input.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 * Avoids problems with remote access getting interference from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 * the keyboard.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 if (wtime == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 return 0; /* Ignore quick key checks */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 if (xswi(OS_ReadC) & c_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 got_int = TRUE; /* ESC pressed - can this happen? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 swi(OS_Byte, 124); /* Clear Escape state */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 r0 = 0x1b; /* It *might* not have been Escape! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 buf[0] = r0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 * OK, here's the plan:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 * 1) Wait until wtime expires or we get a key
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 * 2) Get keys until the keyboard buffer is empty or buf is full
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 while (xswi(OS_Byte,145,0) & c_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 /* Nothing at all in the keyboard buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 * Has our time expired yet?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 if ( (wtime != -1) && (clock() - start_time) >= wtime )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 return 0; /* Nothing read - giving up */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 /* We've got one char (in r2) - are there any more? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 while (got < maxlen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 buf[got++] = r2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 if (xswi(OS_Byte,145,0) & c_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 return got; /* Keyboard buffer empty */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 return got; /* buf is full */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 * return non-zero if a character is available
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 mch_char_avail()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 if (!term_console)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 return 0; /* Can't tell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 if (xswi(OS_Byte, 152, 0) & c_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 /* Find out how much free memory we have.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 * I don't know how to work this out exactly but, since we can claim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 * more memory from the OS, let's just report the free pool size.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 * Dynamic area 6 doesn't exist pre 3.6 according to StrongHelp, so
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 * we'll use Wimp_SlotSize. If that fails (outside the desktop?)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 * then just return a big number and hope.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 long_u
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 mch_avail_mem(special)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 int special;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 if (xswi(Wimp_SlotSize, -1, -1) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 return 0x7fffffff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 return r2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 mch_delay(msec, ignoreinput)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 long msec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 int ignoreinput;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 int start_time, time_now;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 int csec = msec / 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 swi(OS_ReadMonotonicTime);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 start_time = r0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 swi(OS_ReadMonotonicTime);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 time_now = r0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 if (time_now - start_time > csec)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 /* In the GUI, allow other programs to run while waiting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 gui_mch_wait_for_chars(start_time + csec);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 * If the machine has job control, use it to suspend the program,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 * otherwise fake it by starting a new shell.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 mch_suspend()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 suspend_shell();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 mch_init()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 * Read window size first. Calls to mch_get_shellsize() will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 * simply return these values in future so that setting the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 * text window (used for scrolling) won't give strange results.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 int buf[7] = {132, 135, 256, 257, 1, 2, -1};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 /* Command windows are no longer forced open, since if we are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 * in the desktop then we'll use the GUI version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 * Opening a command window here messes up the GUI version startup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 #ifndef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 swi(OS_WriteI);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 swi(OS_ReadVduVariables, buf, buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 WinLeft = buf[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 WinTop = buf[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 Columns = buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 Rows = buf[3] + 1; /* Seems to be one off (VduVars wrong?) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 ScrollTop = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 /* Are we running in a textwindow? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if (Rows == buf[5] + 1 && Columns == buf[4] + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 windowed = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 windowed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 /* Choose a nice colour scheme. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 text_fg(NORMAL_FG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 text_bg(NORMAL_BG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 * Check_win checks whether we have an interactive stdout.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 mch_check_win(argc, argv)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 int argc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 char **argv;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 * Return TRUE if the input comes from a terminal, FALSE otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 mch_input_isatty()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 if (xswi(OS_ChangeRedirection, -1, -1) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 return TRUE; /* Error - TRUE is probably correct though */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 if (r0 == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 mch_can_restore_title()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 mch_can_restore_icon()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 * Set the window title and icon.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 mch_settitle(title, icon)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 char_u *title;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 char_u *icon;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 if (title == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 title = (char_u *) "<untitled>";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 if (gui.in_use && strcmp(title, gui.window_title))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 int length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 length = strlen(title);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 if (length >= gui.window_title_size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 length = gui.window_title_size - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 strncpy(gui.window_title, title, length);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 gui.window_title[length] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 ro_redraw_title(gui.window_handle);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 * Restore the window/icon title.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 * "which" is one of:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 * 1 only restore title
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 * 2 only restore icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 * 3 restore title and icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 mch_restore_title(which)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 int which;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 * Insert user name in s[len].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 * Return OK if a name found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 mch_get_user_name(s, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 /* RISC OS doesn't support user names. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 *s = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 * Insert host name in s[len].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 mch_get_host_name(s, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 if (xswi(OS_ReadVarVal, "Machine$Name", s, len, 0, 3) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 /* Variable does not exist (normal operation) */
416
3da34f87c760 updated for version 7.0109
vimboss
parents: 35
diff changeset
526 vim_strncpy(s, "(unknown)", len - 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 * return process ID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 mch_get_pid()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 if (xswi(Wimp_ReadSysInfo, 5) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 return r0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 * Get name of current directory into buffer 'buf' of length 'len' bytes.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 * Return OK for success, FAIL for failure.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 mch_dirname(buf, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 if (xswi(OS_FSControl, 37, "@", buf, 0, 0, len) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 * Get absolute file name into buffer 'buf' of length 'len' bytes.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 * return FAIL for failure, OK for success
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 mch_FullName(fname, buf, len, force)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 char_u *fname, *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 int force; /* Also expand when already absolute path name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 * Not used under RISC OS.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 if (xswi(OS_FSControl, 37, fname, buf, 0, 0, len) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 * Return TRUE if "fname" does not depend on the current directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 mch_isFullName(fname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 char_u *fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 if (strstr(fname, "::") && strstr(fname,".$."))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 * Get file permissions for 'name'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 * Returns -1 when it doesn't exist.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 mch_getperm(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 struct stat statb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 if (stat((char *)name, &statb))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 return statb.st_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 * set file permission for 'name' to 'perm'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 * return FAIL for failure, OK otherwise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 mch_setperm(name, perm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 long perm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 return (chmod((char *)name, (mode_t)perm) == 0 ? OK : FAIL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 * Set hidden flag for "name".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 mch_hide(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 /* can't hide a file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 * return TRUE if "name" is a directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 * return FALSE if "name" is not a directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 * return FALSE for error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 mch_isdir(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 if (xswi(OS_File, 17, name) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 if (r0 == 2 || r0 == 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 return TRUE; /* Count image files as directories. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 #if defined(FEAT_EVAL) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 * Return 1 if "name" can be executed, 0 if not.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 * Return -1 if unknown. Requires which to work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 mch_can_exe(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 buf = alloc((unsigned)STRLEN(name) + 7);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 if (buf == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 sprintf((char *)buf, "which %s", name);
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 7
diff changeset
657 p = get_cmd_output(buf, NULL, SHELL_SILENT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 vim_free(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 if (p == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 /* result can be: "name: Command not found" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 retval = (*p != NUL && strstr((char *)p, "not found") == NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 vim_free(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669 * Check what "name" is:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 * NODE_NORMAL: file or directory (or doesn't exist)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 * NODE_WRITABLE: writable device, socket, fifo, etc.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 * NODE_OTHER: non-writable things
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 mch_nodetype(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 char_u *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 /* TODO */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 return NODE_NORMAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 mch_early_init()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 /* Turn off all the horrible filename munging in UnixLib. */
35
8f3a526c2fe1 updated for version 7.0021
vimboss
parents: 24
diff changeset
686 int __riscosify_control = __RISCOSIFY_NO_PROCESS;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 mch_exit(r)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 settmode(TMODE_COOK);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 exiting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 ml_close_all(TRUE); /* remove all memfiles */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 gui_exit(r);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 swi(OS_NewLine);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 if (old_escape_state != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 swi(OS_Byte, 229, old_escape_state, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 if (old_cursor_state != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 swi(OS_Byte, 4, old_cursor_state);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 exit(r);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 mch_settmode(tmode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 int tmode; /* TMODE_RAW or TMODE_COOK */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 if (tmode == TMODE_COOK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 ro_line_mode = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 ro_line_mode = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 if (term_console)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 /* Block cursor. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 swi(OS_WriteN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 "\027\000\012\000\000\000\000\000\000\000",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 10);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 /* Disable the standard cursor key actions. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 swi(OS_Byte, 4, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 if (old_cursor_state == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 old_cursor_state = r1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 /* Stop Escape from quitting Vim! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 swi(OS_Byte, 229, 1, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 if (old_escape_state == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 old_escape_state = r1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 * set mouse clicks on or off (only works for xterms)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 mch_setmouse(on)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 int on;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 * set screen mode, always fails.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 mch_screenmode(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 char_u *arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 {
35
8f3a526c2fe1 updated for version 7.0021
vimboss
parents: 24
diff changeset
758 EMSG(_(e_screenmode));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 * Try to get the current window size.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 * Return OK when size could be determined, FAIL otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 * Simply return results stored by mch_init() if we are the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 * machine's console. If not, we don't know how big the screen is.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 mch_get_shellsize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 /* if size changed: screenalloc will allocate new screen buffers */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 return term_console ? OK : FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 * Can't change the size.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 * Assume the user knows what he's doing and use the new values.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 mch_set_shellsize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 /* Assume the user knows what he's doing and use the new values. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 * Rows and/or Columns has changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 mch_new_shellsize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 /* Nothing to do. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 mch_call_shell(cmd, options)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 char_u *cmd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 int options; /* SHELL_*, see vim.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 int tmode = cur_tmode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 if (cmd == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 cmd = (char_u *) "GOS";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 return gui_mch_call_shell(cmd, options);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 if (options & SHELL_COOKED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 settmode(TMODE_COOK); /* set to normal mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 MSG_PUTS("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 /* I don't even want to think about what UnixLib must
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 * be doing to allow this to work...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 retval = system(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 if (retval && !(options & SHELL_SILENT))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 EMSG(strerror(EOPSYS)); /* Doesn't seem to set errno? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 swi(OS_Byte, 229, 1, 0); /* Re-disable escape */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 if (tmode == TMODE_RAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 settmode(TMODE_RAW); /* set to raw mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 return retval ? FAIL : OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 * Check for Escape being pressed right now.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 * [ different if !term_console? ]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 mch_breakcheck()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 if (xswi(OS_Byte, 121, 0xf0) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 if (r1 == 0xff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 got_int = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 swi(OS_Byte, 15, 1); /* Flush input buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 * Recursively expand one path component into all matching files and/or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 * directories.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 * "path" has backslashes before chars that are not to be expanded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 * Return the number of matches found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 mch_expandpath(gap, path, flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 garray_T *gap; /* Grow array for results. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 char_u *path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 int flags; /* EW_* flags */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 int got; /* Number of matches. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 char_u *pattern;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 /* Plan:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 * 1) Get first part of path - no wildcards
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 * 2) Get next path element (wildcarded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 * 3) Get rest of path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 * If (3) is nothing then only the leaf is wildcarded - add to gap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 * Otherwise call recursively for each path in (2), passing (3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 * This is just the header function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 /* We must be able to modifiy path, so make a copy */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 pattern = vim_strsave(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 if (pattern == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 got = expand_section(gap, (char_u *)"", pattern, flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 vim_free(pattern);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 return got;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 * expand_section(gap, "$.Dir1.Dir2", "ABBA*.myleaf##")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 * calls expand_section(gap, "$.Dir1.Dir2.ABBA_Gold", "myleaf##")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 * and expand_section(gap, "$.Dir1.Dir2.ABBA_Live", "myleaf##")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 * If rest is just a leaf then all matches are added to gap.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 * Returns number of items added to gap.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 expand_section(gap, root, rest, flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 garray_T *gap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 char_u *root; /* Non-wildcarded path to search */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 char_u *rest; /* Wildcarded remainder of path */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 int flags; /* Add dirs/files/missing objects. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 static char_u buf[MAXPATHL]; /* Temporary buffer. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 char_u dir[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 int start_element = -1; /* Start of wildcarded element */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 char_u c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 int got, dir_pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 int buflen; /* Chars used in buf[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 int colon = 0; /* Dir ends in ':' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 buflen = strlen(root);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 STRNCPY(buf, root, buflen); /* Copy root into buffer. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 * Find end of nonwildcarded section.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 * Count ':' as a path sep since Vim:Bug* is a valid pathname.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 for (i = 0; c = rest[i]; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 if (c == PATHSEP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 start_element = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 colon = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 if (c == ':')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 start_element = i + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 colon = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 if (c == '#' || c == '*')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 if (c == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 start_element = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 * start_element +> terminator for non-wildcarded section.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 * Transfer this bit into buf.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 if (buflen + start_element + 4 >= MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 return 0; /* Buffer full */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 if (start_element >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 if (*root && !colon)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 buf[buflen++] = PATHSEP;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 strncpy(buf + buflen, rest, start_element);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 buflen += start_element;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 buf[buflen] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 * Did we reach the end of the string without hitting any wildcards?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 if (c == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 /* Yes - add combined path to grow array and return. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 addfile(gap, buf, flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 if (start_element < 0 || !colon)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 start_element++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 rest += start_element;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 * rest does contain wildcards if we get here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 * Now : have we reached the leaf names part yet?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 * If so, add all matches (files and dirs) to gap.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 * If not, get next path element and scan all matching directories.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 start_element = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 for (i = 0; rest[i]; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 if (rest[i] == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 start_element = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 rest[i] = 0; /* Break string here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 /* If start_element is -1 then we are matching leaf names */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 r3 = 0; /* Number of objs read. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 dir_pos = 0; /* Position through directory. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 got = 0; /* Files added so far. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 while (dir_pos != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 buf[buflen] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 if (xswi(OS_GBPB, 9,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 buf, /* Directory to scan. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 buf + buflen + (1 - colon), /* Buffer for result. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 1, /* Number of objects to read. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 dir_pos, /* Search position. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 MAXPATHL - 2 - buflen, /* Size of result buffer. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 rest) /* Wildcarded leafname. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 EMSG(r0 + 4);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 r4 = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 dir_pos = r4; /* r4 corrupted by addfile() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 if (r3 > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 char_u *path = buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 if (buflen == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 path++; /* Don't do '.File' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 else if (!colon)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 buf[buflen] = '.'; /* Join path and leaf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 /* Path -> full path of object found */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 if (start_element == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 addfile(gap, path, flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 got++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 /* Scan into subdirectories and images; ignore files */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016 swi(OS_File, 17, path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 if (r0 == 2 || r0 == 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 got += expand_section(gap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 path,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 rest + start_element + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 /* Restore the dot if we removed it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 if (start_element >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 rest[start_element] = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 return got;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 * mch_expand_wildcards() - this code does wild-card pattern matching using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 * the shell. It isn't used under RISC OS.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 * return OK for success, FAIL for error (you may lose some memory) and put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 * an error message in *file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 * num_pat is number of input patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 * pat is array of pointers to input patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 * num_file is pointer to number of matched file names
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 * file is pointer to array of pointers to matched file names
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 mch_expand_wildcards(num_pat, pat, num_file, file, flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 int num_pat;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 char_u **pat;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 int *num_file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 char_u ***file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 int flags; /* EW_* flags */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 /* This doesn't get called unless SPECIAL_WILDCHAR is defined. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 * Return TRUE if "p" contains wildcards which can be expanded by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 * mch_expandpath().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 mch_has_exp_wildcard(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 if (vim_strpbrk((char_u *)"*#", p))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 /* Return TRUE if "p" contains wildcards. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 mch_has_wildcard(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 if (vim_strpbrk((char_u *)"*#`", p))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 int /* see Unix unlink(2) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 mch_remove(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 char_u *file; /* Name of file to delete. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 if (xswi(OS_FSControl, 27, file, 0, 0) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 return EXIT_FAILURE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 return EXIT_SUCCESS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 /* Try to make existing scripts work without modification.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 * Return a pointer to the new string (freed by caller), or NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 * Two main cases:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 * - Absolute : $VIM/syntax/help.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 * - Relative : Adfs::4.$.!Vim.Resources.Syntax/help.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 char_u *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 mch_munge_fname(fname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 char_u *fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 char_u c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 char_u *retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 retval = fname = vim_strsave(fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 if (fname == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 if (strncmp(fname, "$VIM/", 5) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 strncpy(fname, "Vim:", 4);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 for (fname += 5; c = *fname; fname++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 if (c == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 if (c == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 fname[-1] = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 fname[-1] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 fname[-1] = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 /* Check to see if the file exists without modification. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 if (xswi(OS_File, 17, fname) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 r0 == 0; /* Invalid filename? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 if (r0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 len = strlen(fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 if (strcmp(fname + len - 4, ".vim") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 fname[len - 4] = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 for (; c = *fname; fname++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 if (c == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 *fname = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 /* QuickFix reads munged names from the error file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 * Correct them.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 ro_buflist_add(old_name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 char_u *old_name; /* Name of file found by quickfix */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 char_u *fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 char_u *leaf; /* Pointer to start of leaf in old_name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 char_u *ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 char_u c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 if (old_name == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 return buflist_add(NULL, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 /* Copy the name so we can mess around with it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 fname = vim_strsave(old_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 if (fname == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 /* Out of memory - can't modify name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 return buflist_add(old_name, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 /* Change `dir/main.c' into `dir.c.main' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 leaf = fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 for (ptr = fname; c = *ptr; ptr++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 if (c == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 leaf = ptr + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 *ptr = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 else if (c == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 if (c == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 /* Change `main.c' into `c.main'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 * | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 * leaf ptr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 ptr += old_name - fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 *ptr = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 sprintf(leaf,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 "%s.%s",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 ptr + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 leaf - fname + old_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 retval = buflist_add(fname, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 free(fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 /* Change the current directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 * Strip trailing dots to make it easier to use with filename completion.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 * Return 0 for success, -1 for failure.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 mch_chdir(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 char_u *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 int length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 char_u *new_dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 length = strlen(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 if (dir[length - 1] != '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 return chdir(dir); /* No trailing dots - nothing to do. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 new_dir = vim_strsave(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 if (new_dir == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 return chdir(dir); /* Can't allocate memory. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 while (new_dir[--length] == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 new_dir[length] = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 retval = chdir(new_dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 vim_free(new_dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 /* Examine the named file, and set the 'osfiletype' option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 * (in curbuf) to the file's type.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 mch_read_filetype(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 char_u *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 char_u type_string[9];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 if (xswi(OS_File, 23, file) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 type = 0xfff; /* Default to Text */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 type = r6;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 /* Type is the numerical value - see if we have a textual equivalent */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 swi(OS_FSControl, 18, 0, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 ((int *) type_string)[0] = r2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 ((int *) type_string)[1] = r3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 type_string[8] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 for (i = 0; type_string[i] > ' '; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 type_string[i] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 set_string_option_direct("osfiletype", -1, type_string, OPT_FREE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 mch_set_filetype(file, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 char_u *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 char_u *type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 if (xswi(OS_FSControl, 31, type) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 EMSG(_("E366: Invalid 'osfiletype' option - using Text"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 r2 = 0xfff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 swi(OS_File, 18, file, r2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 /* Return TRUE if the file's type matches 'type'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 * RISC OS types always start with '&'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 mch_check_filetype(fname, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 char_u *fname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 char_u *type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 int value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 char *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 if (*type != '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 value = strtol(type + 1, &end, 16);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 if (*end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 return FALSE; /* Invalid type (report error?) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 if (xswi(OS_File, 23, fname) & v_flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 return FALSE; /* Invalid filename? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 return (r0 && r6 == value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 }