Exemplo n.º 1
0
void ParseBool(char *buffer)
{
string VarName="";
// skip boool 
int i=5;
while(buffer[i]!= '=')
	VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// now get the variable value up to the ; token
// skip = sign
i++;
VarName="";
while(buffer[i]!= ';')
	VarName+=buffer[i++];
bool vf;
if(VarName == "true")
	vf=true;
else if(VarName == "false")
	vf=false;
else
	{
	cout <<"***************ERROR IN COMPILATION**********************"<<endl;
	cout <<" Error in compilation line :"<<line<<endl;
	cout <<" bool data type must be initialised as either true or false "<<endl;
	cout << "****************** COMPILATION FAILED EXITING ***********"<<endl;
	exit(0);
	}
VarObj Vo(vf);
Globals.Add(Vo);
}
Exemplo n.º 2
0
void ParseVector(char *buffer)
{
string VarName="";
char val[BUFFSIZE];
//Vector vf;
// skip Vector
int i=7;
int s=0;
while(buffer[i]!= '=')
	VarName+=buffer[i++];
//VarName[s]='\0';
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z,w;
s=0;
while(buffer[i]!= ',')
	val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);

i++; s=0;
while(buffer[i]!= ',')
	val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);

i++; s=0;
while(buffer[i]!= ',')
	val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
i++; s=0;
while(buffer[i]!= ']')
	val[s++]=buffer[i++];
val[s]='\0';
w=atof(val);
Vec4 vf(x,y,z,w);
VarObj Vo(vf);
Globals.Add(Vo);
//cout <<"Buffer "<<buffer <<" ";
//cout <<"X "<<x<<" Y "<<y <<" z "<<z<<endl;
}
Exemplo n.º 3
0
void ParsePoint(char *buffer)
{
string VarName="";
char val[30];
Vec3 vf;
// skip Vector
int i=6;
int s=0;
while(buffer[i]!= '=')
	VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z;
s=0;
while(buffer[i]!= ',')
	val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);

i++; s=0;
while(buffer[i]!= ',')
	val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);

i++; s=0;
while(buffer[i]!= ']')
	val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
vf.set(x,y,z);
VarObj Vo(vf);
Globals.Add(Vo);
}
Exemplo n.º 4
0
void ParseFuzzy(char *buffer)
{
string VarName="";
char val[30];
fuzzy vf;
// skip float 
int i=6;
int s=0;
while(buffer[i]!= '=')
	VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// now get the variable value up to the ; token
// skip = sign
i++;
while(buffer[i]!= ';')
	val[s++]=buffer[i++];
vf=atof(val);
VarObj Vo(vf);
Globals.Add(Vo);
}