/***************************************************************************
 *   Copyright (C) 2009 by Juergen Thies                                   *
 *   layout@juergenthies.de                                                *
 *                                                                         *
 ***************************************************************************/
#include "schematic/schematic.h"


void macro::sElementHandler_registerKeywords(keywords **keyword_){
  *keyword_= new keywords(*keyword_);
 (*keyword_)->keyword="sElement";
 (*keyword_)->type=type;
 (*keyword_)->typeHandler=&macro::sElementHandler_typeHandler;
}

void macro::sElementHandler_typeHandler(int *counter,keywords **keyword_,bool single){
generalTypeProcessing(counter,keyword_,ptrSElement,ptrSElement,single);
}

returnValue macro::sElementHandler_classHandler(int *counter, keywords *keyword_,returnValue* r,bool left){
 QString s;
 returnValue ret;
 parserValue p;
 if (r->type==ptrSElement){
   if (checkClassPointer(counter)) {
   }
   else { 
   	if (left) { compute(r,counter,keyword_);return ret;}
     	else return *r;
	}
   }
 sElement *l= r->getSElement();
 p=next(counter);
;
 // variables
 if ((p.type==keyword)&&(p.value=="fil en am e")){
/* 		returnValue r2;
		r2.type=varString;
		r2.deleteAfter=false;
		r2.s=&(l->filename);
		//printf("fn %s\n",l->filename.toAscii().data());
		r2=stringHandler_classHandler(counter,keyword_,&r2,left);
		return r2;*/
 	}

else if ((p.type==keyword)&&(p.value=="addParameter")){
 		testParenOpen(counter);
		returnValue p1=calculate(counter,keyword_);
		testComma(counter);
		returnValue p2=calculate(counter,keyword_);
		testParenClose(counter);
		l->addParameter(p1.getString(),p2.getString());
 	}
 else {
  	error->addItem(tr("Class sElement has no member ")+p.value,1,message((*counter)));
	throw 1;
 	}
 if (left)  if (!checkSemicolon(counter)) {throw 15;}  
 return ret;
}

