/***************************************************************************
 *   Copyright (C) 2005 by Juergen Thies                                   *
 *   layout@juergenthies.de                                                *
 *                                                                         *
 *   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.             *
 ***************************************************************************/




void macro::CELHandler_registerKeywords(keywords **keyword_, componentPlacement *cp){
 *keyword_= new keywords(*keyword_);
 (*keyword_)->keyword="iPar";
 (*keyword_)->type=intClass;
 (*keyword_)->r=new returnValue();
 (*keyword_)->r->setType(ptrSElement);
 (*keyword_)->r->setPtrSElement((sElement *)cp);
 (*keyword_)->classHandler=&macro::iParHandler_classHandler;
}

#include "macro/string.h"

returnValue macro::iParHandler_classHandler(int *counter, keywords *keyword_,returnValue* r,bool left){
 QString s;
 returnValue ret;
 //printf("ipar\n");
 sElement *c= r->getSElement();
 componentPlacement *cp=reinterpret_cast<componentPlacement *>(c);
 testParenOpen(counter);
 returnValue p1=calculate(counter,keyword_);
 testParenClose(counter);
 s=p1.getString();
 // printf("parameter: %s\n",s.toAscii().data());
 if (cp->existParameter(s)){
    //s=cp->getParameter(s);
    componentParameter c=cp->getComponentParameter(s);
    s=c.getParsedValue(cp);
    //printf("value: %s(%f)\n",c.getValue().toAscii().data());
    #ifdef  _MSC_VER
      class string s1(s);
    #else
      string::string s1(s);
    #endif
    //printf("read par: %s(%f)\n",s.toAscii().data(),s1.toEngDouble());
    if (c.parseAsNum) ret.setDouble(s1.toEngDouble());
    else ret.setString(s);
 }
 else ret.setString("");
 return ret;
}

