File: interpreter.h

package info (click to toggle)
evms 1.0.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,168 kB
  • ctags: 5,853
  • sloc: ansic: 87,317; makefile: 691; sh: 238
file content (178 lines) | stat: -rw-r--r-- 7,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
 *
 *   Copyright (c) International Business Machines  Corp., 2001
 *
 *   This program is free software;  you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program;  if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Module: interpreter.h
 */

/*
 * Change History:
 *
 * 6/2001  B. Rafanello  Initial version.
 *
 */


#ifndef INTERPRETER_H

#define INTERPRETER_H 1

#include "dlist.h"
#include "frontend.h"


/* Define a typecode for use with the dlist module. */
#define STACK_NODE  94393920

/* The interpreter takes in a tree consisting of nodes as defined below and executes them, returning the result. */
typedef enum {
               StringData,
               IntegerData,
               RealNumberData,
               Units_Node,
               Precision_Node,
               Allocate_Node,
               Assign_Node,
               Check_Node,
               Create_Node,
               Defragment_Node,
               Delete_Node,
               Expand_Node,
               Format_Node,
               Unformat_Node,
               Shrink_Node,
               Set_Node,
               Remove_Node,
               Rename_Node,
               Revert_Node,
               Query_Node,
               Query_Node_Type_2,
               Query_Extended_Info,
               Help_Node,
               Task_Adjust,
               Topmost_Objects,
               Filter,
               Freespace_Size_Filter,
               Feature_ID,
               Feature_Name,
               Plugin_ID,
               Plugin_Name,
               Plugin_Mask,
               Probe_Node,
               Name_Value_Pair,
               ObjectList,
               Name_To_Volume_Handle,
               Name_To_Object_Handle,
               Name_To_Region_Handle,
               Name_To_Container_Handle,
               Name_To_Segment_Handle,
               Name_To_Disk_Handle,
               Name_To_Plugin_Handle,
               Translate_Name_To_Handle
             } NodeTypes;

typedef struct {
                 NodeTypes  NodeType;
                 void *     NodeValue;
                 dlist_t    Children;
               } Executable_Node;


#ifndef DEBUG_PARSER

/*--------------------------------------------------
 * Public Global Variables
 --------------------------------------------------*/

#ifdef INTERPRETER_C

int Verbose_Mode = 0;    /* 0 = no verbose, 1 = EVMS Engine messages reported one per line, 2 = EVMS Engine messages overlayed on top of each other. */

#else

extern int Verbose_Mode;

#endif


/*********************************************************************/
/*                                                                   */
/*   Function Name: Interpret_Commands                               */
/*                                                                   */
/*   Descriptive Name: Takes a dlist_t of commands, where each command */
/*                     is represented as a tree of Executable_Node   */
/*                     entities, and attempts to interpret them,     */
/*                     thereby executing the command they represent. */
/*                                                                   */
/*   Input: dlist_t Commands - A list of tree structures, where each */
/*                           tree structure is composed of nodes of  */
/*                           type Executable_Node.  Each tree        */
/*                           represents a command to execute.        */
/*          Global_Commit - if TRUE, then a single commit will be    */
/*                          performed after all commands in Commands */
/*                          have been processed.                     */
/*          Interactive - If TRUE, then we are not processing a      */
/*                        command file and the Probe command (which  */
/*                        translates to an evms_rediscover() call)   */
/*                        and other commands not allowed in command  */
/*                        files are allowed.                         */
/*          Debug - The debug level to use as specified by the user. */
/*                                                                   */
/*   Output: The function return value is 0 if no errors occurred,   */
/*           a non-zero return value otherwise.                      */
/*                                                                   */
/*   Error Handling:                                                 */
/*                                                                   */
/*   Side Effects: The state of the EVMS engine may be altered by the*/
/*                 commands being interpreted by this function.  This*/
/*                 may lead to modifications of the volumes in the   */
/*                 system.                                           */
/*                                                                   */
/*   Notes:                                                          */
/*                                                                   */
/*********************************************************************/
int Interpret_Commands(dlist_t Commands, BOOLEAN Global_Commit, BOOLEAN Interactive, debug_level_t Debug);

/*********************************************************************/
/*                                                                   */
/*   Function Name: Commit_Changes                                   */
/*                                                                   */
/*   Descriptive Name: If any changes have been made but not yet     */
/*                     written to disk, then this function will      */
/*                     cause them to be written to disk.  This is a  */
/*                     wrapper for the evms_commit_changes function. */
/*                                                                   */
/*   Input: None.                                                    */
/*                                                                   */
/*   Output: The function return value is 0 if no errors occurred,   */
/*           a non-zero return value otherwise.  This function will  */
/*           print the status messages returned by the EVMS Engine   */
/*           during the commit process.                              */
/*                                                                   */
/*   Error Handling:                                                 */
/*                                                                   */
/*   Side Effects: This function will cause the EVMS engine to write */
/*                 any pending changes to disk.                      */
/*                                                                   */
/*   Notes:                                                          */
/*                                                                   */
/*********************************************************************/
int Commit_Changes(void);

#endif

#endif