* Sync with recent trunk (r52637).
[reactos.git] / base / shell / cmd / batch.h
1 /*
2 * BATCH.H - A structure to preserve the context of a batch file
3 *
4 *
5 */
6
7 #pragma once
8
9 typedef struct tagBATCHCONTEXT
10 {
11 struct tagBATCHCONTEXT *prev;
12 char *mem; /* batchfile content in memory */
13 DWORD memsize; /* size of batchfile */
14 DWORD mempos; /* current position to read from */
15 BOOL memfree; /* true if it need to be freed when exitbatch is called */
16 TCHAR BatchFilePath[MAX_PATH];
17 LPTSTR params;
18 LPTSTR raw_params; /* Holds the raw params given by the input */
19 INT shiftlevel[10];
20 BOOL bEcho; /* Preserve echo flag across batch calls */
21 REDIRECTION *RedirList;
22 PARSED_COMMAND *current;
23 struct _SETLOCAL *setlocal;
24 } BATCH_CONTEXT, *LPBATCH_CONTEXT;
25
26 typedef struct tagFORCONTEXT
27 {
28 struct tagFORCONTEXT *prev;
29 TCHAR firstvar;
30 UINT varcount;
31 LPTSTR *values;
32 } FOR_CONTEXT, *LPFOR_CONTEXT;
33
34
35 /* The stack of current batch contexts.
36 * NULL when no batch is active
37 */
38 extern LPBATCH_CONTEXT bc;
39
40 extern LPFOR_CONTEXT fc;
41
42 extern BOOL bEcho; /* The echo flag */
43
44 #define BATCH_BUFFSIZE 8192
45
46 extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */
47
48
49 LPTSTR FindArg (TCHAR, BOOL *);
50 LPTSTR BatchParams (LPTSTR, LPTSTR);
51 VOID ExitBatch (VOID);
52 INT Batch (LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *);
53 BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength);
54 LPTSTR ReadBatchLine(VOID);
55 VOID AddBatchRedirection(REDIRECTION **);