1
/* Copyright (c) 1996-2004, Adaptec Corporation
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* - Redistributions of source code must retain the above copyright notice, this
8
* list of conditions and the following disclaimer.
9
* - Redistributions in binary form must reproduce the above copyright notice,
10
* this list of conditions and the following disclaimer in the documentation
11
* and/or other materials provided with the distribution.
12
* - Neither the name of the Adaptec Corporation nor the names of its
13
* contributors may be used to endorse or promote products derived from this
14
* software without specific prior written permission.
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
* POSSIBILITY OF SUCH DAMAGE.
32
/****************************************************************************
36
*****************************************************************************
38
* File Name: Parser.hpp
40
* Contributors: Lee Page
41
* Description: This class is an object factory that accepts a command-line string
42
in. Then it creates a an array of objects, one per command.
43
This array can then be fetched and executed.
49
*****************************************************************************/
52
#include "cmdlist.hpp"
53
#include "creatrad.hpp"
54
#include "scsilist.hpp"
55
#include "intlist.hpp"
67
bool *quiet_Mode_Ptr // A pointer to the quiet mode boolean
71
Command_List &get_Command_List();
74
/* static const unsigned long RAID_0_DEFAULT_STRIPE_SIZE;
75
static const unsigned long RAID_1_DEFAULT_STRIPE_SIZE;
76
static const unsigned long RAID_5_DEFAULT_STRIPE_SIZE;
77
*/ static const unsigned long BLOCK_SIZE;
78
// a structure used in the retrieving of a constant associated with a string.
79
struct str_to_Const_Struct
81
char *str; // this is the string that is associated with the
85
char *Extract_Command( char *this_Commands_Text, char *buffer );
86
char *Extract_Word( char *str, char *word );
87
char *TranslateNext (char *str, int *retVal);
88
char *Skip_White( char *str );
89
char *Skip_Non_White( char *str );
90
char *Skip_Non_Word( char *str );
91
char *Skip_Word( char *str );
92
static void To_Lower( char *str );
97
void Reset_Params_to_Defaults();
98
void Error_in_Parsing(
100
char *this_Command_Line
103
char *str_to_Match, // this is the string the user supplies
104
str_to_Const_Struct *str_to_Const // this is an array in which we have
105
// to match the string the user supplies
107
Int_List *Get_Int_List(
108
char *int_Str, // pointer to a list of comma
109
// delimited constants
110
char **end_Ptr, // this will be set to point
111
// to the end of the parsed list
112
char *this_Commands_Text, // this is the whole command,
113
// used to create a context-based
114
// error string when the command fails
115
bool *done // set true when an error is
119
char *address_Str, // pointer to an address
120
SCSI_Address * component
122
SCSI_Addr_List *Get_Address_List(
123
char *address_Str, // pointer to a list of comma
124
// delimited constants
125
char **end_Ptr, // this will be set to point
126
// to the end of the parsed list
127
char *this_Commands_Text, // this is the whole command,
128
// used to create a context-based
129
// error string when the command fails
130
bool *done // set true when an error is
135
Command_List *cmd_List;
137
// the "..._Specified" bool is intended to aid in parameter checking to make
138
// sure that mandatory parameters are used, else the command invocation fails.
141
bool hba_Num_Specified;
144
bool hba_Bus_Specified;
147
bool unix_Style_Hba_Num_Specified;
148
char *unix_Style_Hba_Num;
150
bool raid_Type_Specified;
151
Create_Raid::Raid_Type raid_Type;
153
bool stripe_Size_Specified;
154
unsigned long stripe_Size;
156
bool task_Rate_Specified;
159
// this is 1024 x 1024
160
bool logical_Drive_Capacity_in_Megs_Specified;
161
unsigned long logical_Drive_Capacity_in_Megs;
163
Int_List *logical_Drive_Number;
168
/*** END OF FILE ***/