msctf: Implement ITfThreadMgr::EnumDocumentMgrs.
[wine/multimedia.git] / programs / cmd / wcmd.h
blob667b3b9905121efc6c9c81aa2bd1becd4c6c3f4d
1 /*
2 * CMD - Wine-compatible command line interface.
4 * Copyright (C) 1999 D A Pickles
5 * Copyright (C) 2007 J Edmeades
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define IDI_ICON1 1
23 #include <windows.h>
24 #include <windef.h>
25 #ifndef RC_INVOKED
26 #include <string.h>
27 #include <stdlib.h>
28 #include <stdarg.h>
29 #include <stdio.h>
30 #include <ctype.h>
31 #include <wine/unicode.h>
33 /* Data structure to hold commands to be processed */
35 typedef enum _CMDdelimiters {
36 CMD_NONE, /* End of line or single & */
37 CMD_ONFAILURE, /* || */
38 CMD_ONSUCCESS, /* && */
39 CMD_PIPE /* Single */
40 } CMD_DELIMITERS;
42 typedef struct _CMD_LIST {
43 WCHAR *command; /* Command string to execute */
44 WCHAR *redirects; /* Redirects in place */
45 struct _CMD_LIST *nextcommand; /* Next command string to execute */
46 CMD_DELIMITERS prevDelim; /* Previous delimiter */
47 int bracketDepth;/* How deep bracketing have we got to */
48 WCHAR pipeFile[MAX_PATH]; /* Where to get input from for pipes */
49 } CMD_LIST;
51 void WCMD_assoc (WCHAR *, BOOL);
52 void WCMD_batch (WCHAR *, WCHAR *, int, WCHAR *, HANDLE);
53 void WCMD_call (WCHAR *command);
54 void WCMD_change_tty (void);
55 void WCMD_clear_screen (void);
56 void WCMD_color (void);
57 void WCMD_copy (void);
58 void WCMD_create_dir (void);
59 BOOL WCMD_delete (WCHAR *, BOOL);
60 void WCMD_directory (WCHAR *);
61 void WCMD_echo (const WCHAR *);
62 void WCMD_endlocal (void);
63 void WCMD_enter_paged_mode(const WCHAR *);
64 void WCMD_exit (CMD_LIST **cmdList);
65 void WCMD_for (WCHAR *, CMD_LIST **cmdList);
66 void WCMD_give_help (WCHAR *command);
67 void WCMD_goto (CMD_LIST **cmdList);
68 void WCMD_if (WCHAR *, CMD_LIST **cmdList);
69 void WCMD_leave_paged_mode(void);
70 void WCMD_more (WCHAR *);
71 void WCMD_move (void);
72 void WCMD_output (const WCHAR *format, ...);
73 void WCMD_output_asis (const WCHAR *message);
74 void WCMD_pause (void);
75 void WCMD_popd (void);
76 void WCMD_print_error (void);
77 void WCMD_pushd (WCHAR *);
78 int WCMD_read_console (WCHAR *string, int str_len);
79 void WCMD_remove_dir (WCHAR *command);
80 void WCMD_rename (void);
81 void WCMD_run_program (WCHAR *command, int called);
82 void WCMD_setlocal (const WCHAR *command);
83 void WCMD_setshow_attrib (void);
84 void WCMD_setshow_date (void);
85 void WCMD_setshow_default (WCHAR *command);
86 void WCMD_setshow_env (WCHAR *command);
87 void WCMD_setshow_path (WCHAR *command);
88 void WCMD_setshow_prompt (void);
89 void WCMD_setshow_time (void);
90 void WCMD_shift (WCHAR *command);
91 void WCMD_title (WCHAR *);
92 void WCMD_type (WCHAR *);
93 void WCMD_verify (WCHAR *command);
94 void WCMD_version (void);
95 int WCMD_volume (int mode, WCHAR *command);
97 WCHAR *WCMD_fgets (WCHAR *s, int n, HANDLE stream);
98 WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where);
99 WCHAR *WCMD_strtrim_leading_spaces (WCHAR *string);
100 void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValue, BOOL justFors);
102 void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
103 WCHAR *WCMD_LoadMessage(UINT id);
104 WCHAR *WCMD_strdupW(WCHAR *input);
105 void WCMD_strsubstW(WCHAR *start, WCHAR* next, WCHAR* insert, int len);
106 BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
107 LPDWORD charsRead, const LPOVERLAPPED unused);
109 WCHAR *WCMD_ReadAndParseLine(WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom);
110 CMD_LIST *WCMD_process_commands(CMD_LIST *thisCmd, BOOL oneBracket, WCHAR *var, WCHAR *val);
111 void WCMD_free_commands(CMD_LIST *cmds);
112 void WCMD_execute (WCHAR *orig_command, WCHAR *redirects, WCHAR *parameter,
113 WCHAR *substitution, CMD_LIST **cmdList);
115 /* Data structure to hold context when executing batch files */
117 typedef struct {
118 WCHAR *command; /* The command which invoked the batch file */
119 HANDLE h; /* Handle to the open batch file */
120 int shift_count[10]; /* Offset in terms of shifts for %0 - %9 */
121 void *prev_context; /* Pointer to the previous context block */
122 BOOL skip_rest; /* Skip the rest of the batch program and exit */
123 CMD_LIST *toExecute; /* Commands left to be executed */
124 } BATCH_CONTEXT;
126 /* Data structure to save setlocal and pushd information */
128 struct env_stack
130 struct env_stack *next;
131 union {
132 int stackdepth; /* Only used for pushd and popd */
133 WCHAR cwd; /* Only used for set/endlocal */
134 } u;
135 WCHAR *strings;
138 /* Data structure to handle building lists during recursive calls */
140 typedef struct _DIRECTORY_STACK
142 struct _DIRECTORY_STACK *next;
143 WCHAR *dirName;
144 WCHAR *fileName;
145 } DIRECTORY_STACK;
147 #endif /* !RC_INVOKED */
150 * Serial nos of builtin commands. These constants must be in step with
151 * the list of strings defined in WCMD.C, and WCMD_EXIT *must* always be
152 * the last one.
154 * Yes it *would* be nice to use an enumeration here, but the Resource
155 * Compiler won't accept resource IDs from enumerations :-(
158 #define WCMD_ATTRIB 0
159 #define WCMD_CALL 1
160 #define WCMD_CD 2
161 #define WCMD_CHDIR 3
162 #define WCMD_CLS 4
163 #define WCMD_COPY 5
164 #define WCMD_CTTY 6
165 #define WCMD_DATE 7
166 #define WCMD_DEL 8
167 #define WCMD_DIR 9
168 #define WCMD_ECHO 10
169 #define WCMD_ERASE 11
170 #define WCMD_FOR 12
171 #define WCMD_GOTO 13
172 #define WCMD_HELP 14
173 #define WCMD_IF 15
174 #define WCMD_LABEL 16
175 #define WCMD_MD 17
176 #define WCMD_MKDIR 18
177 #define WCMD_MOVE 19
178 #define WCMD_PATH 20
179 #define WCMD_PAUSE 21
180 #define WCMD_PROMPT 22
181 #define WCMD_REM 23
182 #define WCMD_REN 24
183 #define WCMD_RENAME 25
184 #define WCMD_RD 26
185 #define WCMD_RMDIR 27
186 #define WCMD_SET 28
187 #define WCMD_SHIFT 29
188 #define WCMD_TIME 30
189 #define WCMD_TITLE 31
190 #define WCMD_TYPE 32
191 #define WCMD_VERIFY 33
192 #define WCMD_VER 34
193 #define WCMD_VOL 35
195 #define WCMD_ENDLOCAL 36
196 #define WCMD_SETLOCAL 37
197 #define WCMD_PUSHD 38
198 #define WCMD_POPD 39
199 #define WCMD_ASSOC 40
200 #define WCMD_COLOR 41
201 #define WCMD_FTYPE 42
202 #define WCMD_MORE 43
204 /* Must be last in list */
205 #define WCMD_EXIT 44
207 /* Some standard messages */
208 extern const WCHAR newline[];
209 extern WCHAR anykey[];
210 extern WCHAR version_string[];
212 /* Translated messages */
213 #define WCMD_ALLHELP 1000
214 #define WCMD_CONFIRM 1001
215 #define WCMD_YES 1002
216 #define WCMD_NO 1003
217 #define WCMD_NOASSOC 1004
218 #define WCMD_NOFTYPE 1005
219 #define WCMD_OVERWRITE 1006
220 #define WCMD_MORESTR 1007
221 #define WCMD_TRUNCATEDLINE 1008
222 #define WCMD_NYI 1009
223 #define WCMD_NOARG 1010
224 #define WCMD_SYNTAXERR 1011
225 #define WCMD_FILENOTFOUND 1012
226 #define WCMD_NOCMDHELP 1013
227 #define WCMD_NOTARGET 1014
228 #define WCMD_CURRENTDATE 1015
229 #define WCMD_CURRENTTIME 1016
230 #define WCMD_NEWDATE 1017
231 #define WCMD_NEWTIME 1018
232 #define WCMD_MISSINGENV 1019
233 #define WCMD_READFAIL 1020
234 #define WCMD_CALLINSCRIPT 1021
235 #define WCMD_ALL 1022
236 #define WCMD_DELPROMPT 1023
237 #define WCMD_ECHOPROMPT 1024
238 #define WCMD_VERIFYPROMPT 1025
239 #define WCMD_VERIFYERR 1026
240 #define WCMD_ARGERR 1027
241 #define WCMD_VOLUMEDETAIL 1028
242 #define WCMD_VOLUMEPROMPT 1029
243 #define WCMD_NOPATH 1030
244 #define WCMD_ANYKEY 1031
245 #define WCMD_CONSTITLE 1032
246 #define WCMD_VERSION 1033
247 #define WCMD_MOREPROMPT 1034
248 #define WCMD_LINETOOLONG 1035
250 /* msdn specified max for Win XP */
251 #define MAXSTRING 8192