//============================================================================== void Graphics::resetToDefaultState() { saveStateIfPending(); context.setFill (FillType()); context.setFont (Font()); context.setInterpolationQuality (Graphics::mediumResamplingQuality); }
SavedState (Direct2DLowLevelGraphicsContext& owner_) : owner (owner_), currentBrush (0), fontHeightToEmSizeFactor (1.0f), currentFontFace (0), clipsRect (false), shouldClipRect (false), clipsRectList (false), shouldClipRectList (false), clipsComplex (false), shouldClipComplex (false), clipsBitmap (false), shouldClipBitmap (false) { if (owner.currentState != nullptr) { // xxx seems like a very slow way to create one of these, and this is a performance // bottleneck.. Can the same internal objects be shared by multiple state objects, maybe using copy-on-write? setFill (owner.currentState->fillType); currentBrush = owner.currentState->currentBrush; clipRect = owner.currentState->clipRect; transform = owner.currentState->transform; font = owner.currentState->font; currentFontFace = owner.currentState->currentFontFace; } else { const D2D1_SIZE_U size (owner.renderingTarget->GetPixelSize()); clipRect.setSize (size.width, size.height); setFill (FillType (Colours::black)); } }
BOOL ON_HatchPattern::IsValid( ON_TextLog* text_log) const { eFillType type = FillType(); BOOL rc = true; if( type != ftSolid && type != ftLines && type != ftGradient) { if( text_log) text_log->Print( "Type field not set correctly.\n"); rc = false; } if( type == ftLines) { int count = m_lines.Count(); if( count < 1) { if( text_log) text_log->Print( "Line type patetern with no lines.\n"); return false; } for( int i = 0; i < count; i++) { if( !m_lines[i].IsValid()) { if( text_log) text_log->Print( "Line[%d] is not valid.\n", i); return false; } } return true; } return rc; }
int LFillType::lnew(lua_State* L) { if(lua_isnoneornil(L,2)) { return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, FillType() )); } else if(LUCE::luce_isofclass(LColour,2)) { return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, FillType(*LUA::from_luce<LColour>(2)) )); } else if(lua_isstring(L,2)) { Colour colour = Colours::findColourForName(LUA::getString(2), Colours::black); return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, FillType(colour) )); } else if(LUCE::luce_isofclass(LColourGradient,2)) { return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, FillType( *LUA::from_luce<LColourGradient>(2) ) )); } else if(LUCE::luce_isofclass(LImage,2)) { Image *img = LUA::from_luce<LImage>(2); AffineTransform aff = LUCE::luce_toaffinetransform(2); return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, FillType(*img, aff) )); } else if(LUCE::luce_isofclass(LFillType,2)) { return LUA::storeAndReturnUserdata<LFillType>(new LFillType(L, *LUA::from_luce<LFillType>(2) )); } else LUCE::luce_error(lua_pushfstring(L, "LFillType: constructor not matched.\nExpected:\n %s,\n %s,\n %s,\n %s,\n %s,\n %s", "()", "(LColour)", "(string)", "(LColourGradient)", "(LImage)", "(LFillType)" )); return 0; }
ValueTree DrawableShape::FillAndStrokeState::getFillState (const Identifier& fillOrStrokeType) { ValueTree v (state.getChildWithName (fillOrStrokeType)); if (v.isValid()) return v; setFill (fillOrStrokeType, FillType (Colours::black), nullptr, nullptr); return getFillState (fillOrStrokeType); }
void CAnalysisHowPage::SetAnalysisToInterface(const CAnalysis& analysis) { const CAnalysisComputation& computation = analysis.GetComputation(); m_selectCtrl.SetCheck(computation.m_bSelectTimeTransformation); if (!m_info.m_period.IsInit()) m_pParent->GetParentInfo(WBSF::GetFM(), m_info, TIME_REF); //WBSF::StringVector nameArray; //m_pParent->GetDimensionList(*m_pFileManager, DIMENSION::TIME_REF, nameArray); //ASSERT( nameArray.size() == 2); //m_sourceTM = p.GetTM(); m_sourceTM = m_info.m_period.GetTM(); //SetTM(m_sourceTM); m_CTTypeCtrl.SetCurSel((int)m_sourceTM.Type()); m_CTModeCtrl.SetCurSel((int)m_sourceTM.Mode()); FillType(); FillMode((int)computation.m_TM.Type()); SetTM(computation.m_TM); SetComputationKind(computation.m_kind); //if( computation.m_kind == CAnalysisComputation::STATISTIC) m_previousStatisticCtrl.SetCurSel(computation.m_previousStatisticType + 1); m_statisticTypeCtrl.SetCurSel(computation.m_statisticType2 + 1); //m_statisticTypeCtrl.SetCurSel(computation.m_statisticType); m_eventTypeCtrl.SetCurSel(computation.m_eventType); m_KCtrl.SetWindowText(ToString(computation.m_K)); m_bDropYearCtrl.SetCheck(computation.m_bDropYear); m_meanOverReplicationCtrl.SetCheck(computation.m_bMeanOverReplication); m_meanOverParameterSetCtrl.SetCheck(computation.m_bMeanOverParameterSet); m_meanOverLocationCtrl.SetCheck(computation.m_bMeanOverLocation); UpdateCtrl(); }
void Graphics::setTiledImageFill (const Image& imageToUse, const int anchorX, const int anchorY, const float opacity) { saveStateIfPending(); context.setFill (FillType (imageToUse, AffineTransform::translation ((float) anchorX, (float) anchorY))); context.setOpacity (opacity); }
void TupItemTweener::fromXml(const QString &xml) { #ifdef K_DEBUG QString msg = "TupItemTweener::fromXml() - Tween content: "; #ifdef Q_OS_WIN qWarning() << msg; qWarning() << xml; #else tWarning() << msg; tWarning() << xml; #endif #endif QDomDocument doc; if (doc.setContent(xml)) { QDomElement root = doc.documentElement(); k->name = root.attribute("name"); k->type = TupItemTweener::Type(root.attribute("type").toInt()); k->initFrame = root.attribute("initFrame").toInt(); k->initLayer = root.attribute("initLayer").toInt(); k->initScene = root.attribute("initScene").toInt(); k->frames = root.attribute("frames").toInt(); QString origin = root.attribute("origin"); // [x,y] QStringList list = origin.split(","); double x = list.first().toDouble(); double y = list.last().toDouble(); k->originPoint = QPointF(x, y); if (k->type == TupItemTweener::Composed) { QDomElement settings = root.firstChildElement("settings"); QDomNode node = settings.firstChild(); while (!node.isNull()) { QDomElement e = node.toElement(); if (!e.isNull()) { if (e.tagName() == "position") { // tError() << "TupItemTweener::fromXml() - Processing position settings"; k->tweenList.append(TupItemTweener::Position); k->compPositionInitFrame = e.attribute("init").toInt(); k->compPositionFrames = e.attribute("frames").toInt(); k->path = e.attribute("coords"); k->intervals = e.attribute("intervals"); } if (e.tagName() == "rotation") { // tError() << "TupItemTweener::fromXml() - Processing rotation settings"; k->tweenList.append(TupItemTweener::Rotation); k->compRotationInitFrame = e.attribute("init").toInt(); k->compRotationFrames = e.attribute("frames").toInt(); k->rotationType = TupItemTweener::RotationType(root.attribute("rotationType").toInt()); k->rotateSpeed = root.attribute("rotateSpeed").toInt(); k->rotateDirection = TupItemTweener::RotateDirection(root.attribute("rotateDirection").toInt()); if (k->rotationType == TupItemTweener::Partial) { k->rotateLoop = root.attribute("rotateLoop").toInt(); k->rotateStartDegree = root.attribute("rotateStartDegree").toInt(); k->rotateEndDegree = root.attribute("rotateEndDegree").toInt(); k->rotateReverseLoop = root.attribute("rotateReverseLoop").toInt(); } } if (e.tagName() == "scale") { // tError() << "TupItemTweener::fromXml() - Processing scale settings"; k->tweenList.append(TupItemTweener::Scale); k->compScaleInitFrame = e.attribute("init").toInt(); k->compScaleFrames = e.attribute("frames").toInt(); } if (e.tagName() == "shear") { // tError() << "TupItemTweener::fromXml() - Processing shear settings"; k->tweenList.append(TupItemTweener::Shear); k->compShearInitFrame = e.attribute("init").toInt(); k->compShearFrames = e.attribute("frames").toInt(); } if (e.tagName() == "opacity") { // tError() << "TupItemTweener::fromXml() - Processing opacity settings"; k->tweenList.append(TupItemTweener::Opacity); k->compOpacityInitFrame = e.attribute("init").toInt(); k->compOpacityFrames = e.attribute("frames").toInt(); } if (e.tagName() == "coloring") { // tError() << "TupItemTweener::fromXml() - Processing coloring settings"; k->tweenList.append(TupItemTweener::Coloring); k->colorFillType = FillType(e.attribute("fillType").toInt()); k->compColoringInitFrame = e.attribute("init").toInt(); k->compColoringFrames = e.attribute("frames").toInt(); } } node = node.nextSibling(); } } else { if (k->type == TupItemTweener::Position) { k->path = root.attribute("coords"); k->intervals = root.attribute("intervals"); } if (k->type == TupItemTweener::Rotation) { k->rotationType = TupItemTweener::RotationType(root.attribute("rotationType").toInt()); k->rotateSpeed = root.attribute("rotateSpeed").toInt(); k->rotateDirection = TupItemTweener::RotateDirection(root.attribute("rotateDirection").toInt()); if (k->rotationType == TupItemTweener::Partial) { k->rotateLoop = root.attribute("rotateLoop").toInt(); k->rotateStartDegree = root.attribute("rotateStartDegree").toInt(); k->rotateEndDegree = root.attribute("rotateEndDegree").toInt(); k->rotateReverseLoop = root.attribute("rotateReverseLoop").toInt(); } } if (k->type == TupItemTweener::Scale) { k->scaleAxes = TupItemTweener::TransformAxes(root.attribute("scaleAxes").toInt()); k->scaleFactor = root.attribute("scaleFactor").toDouble(); k->scaleIterations = root.attribute("scaleIterations").toInt(); k->scaleLoop = root.attribute("scaleLoop").toInt(); k->scaleReverseLoop = root.attribute("scaleReverseLoop").toInt(); } if (k->type == TupItemTweener::Shear) { k->shearAxes = TupItemTweener::TransformAxes(root.attribute("shearAxes").toInt()); k->shearFactor = root.attribute("shearFactor").toDouble(); k->shearIterations = root.attribute("shearIterations").toInt(); k->shearLoop = root.attribute("shearLoop").toInt(); k->shearReverseLoop = root.attribute("shearReverseLoop").toInt(); } if (k->type == TupItemTweener::Opacity) { k->initOpacityFactor = root.attribute("initOpacityFactor").toDouble(); k->endOpacityFactor = root.attribute("endOpacityFactor").toDouble(); k->opacityIterations = root.attribute("opacityIterations").toInt(); k->opacityLoop = root.attribute("opacityLoop").toInt(); k->opacityReverseLoop = root.attribute("opacityReverseLoop").toInt(); } if (k->type == TupItemTweener::Coloring) { k->colorFillType = FillType(root.attribute("fillType").toInt()); QString colorText = root.attribute("initialColor"); QStringList list = colorText.split(","); int red = list.at(0).toInt(); int green = list.at(1).toInt(); int blue = list.at(2).toInt(); k->initialColor = QColor(red, green, blue); colorText = root.attribute("endingColor"); list = colorText.split(","); red = list.at(0).toInt(); green = list.at(1).toInt(); blue = list.at(2).toInt(); k->endingColor = QColor(red, green, blue); k->colorIterations = root.attribute("colorIterations").toInt(); k->colorLoop = root.attribute("colorLoop").toInt(); k->colorReverseLoop = root.attribute("colorReverseLoop").toInt(); } } QDomNode node = root.firstChildElement("step"); while (!node.isNull()) { QDomElement e = node.toElement(); if (!e.isNull()) { if (e.tagName() == "step") { QString stepDoc; { QTextStream ts(&stepDoc); ts << node; } TupTweenerStep *step = new TupTweenerStep(0); step->fromXml(stepDoc); addStep(*step); delete step; } } node = node.nextSibling(); } } }
void XMLCALL start(void *data, const char *el, const char **attr) { int i,Time; struct Node *This ; if (Current==NULL) { Current = CreateNode() ; Haus = Current ; } else { Current = NewChild (Current) ; } ; strncpy (Current->TypeDef,el,NAMELEN) ; Current->Type = FillType (Current->TypeDef) ; for (i = 0; attr[i]; i += 2) { if (strcmp(attr[i],"name")==0) { strncpy(Current->Name,attr[i+1],NAMELEN) ; continue; } ; switch (Current->Type) { case N_ADRESS: if ((strcmp(attr[i],"linie")==0)||(strcmp(attr[i],"line")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Linie)) ; } ; if ((strcmp(attr[i],"knoten")==0)||(strcmp(attr[i],"node")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Knoten)) ; } ; if (strcmp(attr[i],"port")==0) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Port)) ; } ; break ; case N_ACTION: if ((strcmp(attr[i],"kommando")==0)||(strcmp(attr[i],"command")==0)) { Current->Data.Aktion.Type = FillType(attr[i+1]) ; } if ((strcmp(attr[i],"objekt")==0)||(strcmp(attr[i],"object")==0)) { strncpy(Current->Data.Aktion.UnitName,attr[i+1],NAMELEN*4) ; } ; if ((strcmp(attr[i],"autonom")==0)||(strcmp(attr[i],"standalone")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Aktion.StandAlone)) ; } ; break ; case N_SENSOR: if ((strcmp(attr[i],"typ")==0)||(strcmp(attr[i],"type")==0)) { Current->Data.SensorTyp = FillType(attr[i+1]); } ; break ; case N_DELAY: if ((strcmp(attr[i],"zeit")==0)||(strcmp(attr[i],"time")==0)) { sscanf (attr[i+1],"%d",&Time) ; Current->Data.Time.tv_sec = Time/1000 ; Current->Data.Time.tv_usec = Time%1000 * 1000 ; } ; break ; case N_TIMER: if ((strcmp(attr[i],"zeit")==0)||(strcmp(attr[i],"time")==0)) { strncpy(Current->Data.Wert.UnitName,attr[i+1],NAMELEN*4) ; } ; break ; case N_CALL: case N_TASK: if ((strcmp(attr[i],"makro")==0)||(strcmp(attr[i],"macro")==0)) { strncpy(Current->Data.UnitName,attr[i+1],NAMELEN*4) ; } ; break ; case N_IF: case N_SET: case N_REPEAT: if ((strcmp(attr[i],"objekt")==0)||(strcmp(attr[i],"object")==0)) { strncpy(Current->Data.Wert.UnitName,attr[i+1],NAMELEN*4) ; } ; if ((strcmp(attr[i],"wert")==0)||(strcmp(attr[i],"value")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Wert.Wert)) ; } ; if ((strcmp(attr[i],"vergleich")==0)||(strcmp(attr[i],"comparison")==0)) { switch (attr[i+1][0]) { case '<': Current->Data.Wert.Vergleich = -1 ; break ; case '>': Current->Data.Wert.Vergleich = 1 ; break ; case '=': default: Current->Data.Wert.Vergleich = 0 ; break ; } ; } ; break ; case N_VAR: if ((strcmp(attr[i],"wert")==0)||(strcmp(attr[i],"value")==0)) { sscanf(attr[i+1],"%d",&(Current->Value)) ; } ; break ; case N_LANGUAGE: if ((strcmp(attr[i],"ist")==0)||(strcmp(attr[i],"is")==0)) { switch (attr[i+1][0]) { case 'd': setlocale(LC_TIME,"de_DE") ; break ; default: break ; } ; } ; break ; default: break ; } ; } // Ueberpruefen auf Semantik // Namensgleichheit for (This=Current->Prev;This!=NULL;This=This->Prev) { if ((strlen(Current->Name)>0)&&(strcmp(This->Name,Current->Name)==0)) { // Name wurde schon verwendet ParseError = 1 ; fprintf (stderr,"Name doppelt verwendet: ") ; for (This=Current;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\n") ; break ; } } ; // Einzelelemente if (Current->Type==N_ADRESS) { if ((This=FindNodeAdress(Haus,Current->Data.Adresse.Linie,Current->Data.Adresse.Knoten,Current->Data.Adresse.Port,Current))!=NULL) { ParseError = 1 ; fprintf (stderr,"Adresse wurde doppelt verwendet: Linie %d, Knoten %d, Port %d\n", Current->Data.Adresse.Linie,Current->Data.Adresse.Knoten,Current->Data.Adresse.Port) ; fprintf (stderr,"Erste Verwendung: ") ; for (;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\nZweite Verwendung: ") ; for (This=Current;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\n") ; } ; } ; // Element nachbearbeiten // Makros nummerieren if (Current->Type==N_MACRO) { This = NewChild(Current) ; This->Type = N_ADRESS ; This->Data.Adresse.Linie = 0 ; This->Data.Adresse.Knoten = (MakroNummer>>8)+50 ; This->Data.Adresse.Port = (MakroNummer&0xFF) ; MakroNummer++ ; } ;
void XMLCALL start(void *data, const char *el, const char **attr) { int i,j,Time; char Val[5] ; struct Node *This ; struct NodeList *NL ; if (Current==NULL) { Current = CreateNode() ; Haus = Current ; } else { Current = NewChild (Current) ; } ; strncpy (Current->TypeDef,el,NAMELEN) ; Current->Type = FillType (Current->TypeDef) ; if (Current->Type==N_REACT) { // In die Liste der Reactions einhängen if (Reactions==NULL) { Reactions = malloc (sizeof (struct NodeList)) ; Reactions->Next = NULL ; Reactions->Node = Current ; } else { for (NL=Reactions;NL->Next!=NULL;NL=NL->Next) ; NL->Next = malloc (sizeof(struct NodeList)) ; NL = NL->Next ; NL->Next = NULL ; NL->Node = Current ; } ; } ; for (i = 0; attr[i]; i += 2) { if (strcmp(attr[i],"name")==0) { strncpy(Current->Name,attr[i+1],NAMELEN) ; continue; } ; if ((strcmp(attr[i],"wert")==0)||(strcmp(attr[i],"value")==0)) { sscanf(attr[i+1],"%d",&(Current->Value)) ; } ; switch (Current->Type) { case N_STRUCTURE: if ((strcmp(attr[i],"default")==0)||(strcmp(attr[i],"default")==0)) { DefaultFloor = Current ; } ; break ; case N_GROUP: if ((strcmp(attr[i],"nummer")==0)||(strcmp(attr[i],"number")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Group.Number)) ; } ; case N_ADRESS: if ((strcmp(attr[i],"linie")==0)||(strcmp(attr[i],"line")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Linie)) ; } ; if ((strcmp(attr[i],"knoten")==0)||(strcmp(attr[i],"node")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Knoten)) ; } ; if (strcmp(attr[i],"port")==0) { sscanf(attr[i+1],"%d",&(Current->Data.Adresse.Port)) ; } ; break ; case N_ACTION: if ((strcmp(attr[i],"kommando")==0)||(strcmp(attr[i],"command")==0)) { Current->Data.Aktion.Type = FillType(attr[i+1]) ; } if ((strcmp(attr[i],"objekt")==0)||(strcmp(attr[i],"object")==0)) { strncpy(Current->Data.Aktion.UnitName,attr[i+1],NAMELEN*4) ; } ; if ((strcmp(attr[i],"sequenz")==0)||(strcmp(attr[i],"sequence")==0)) { strncpy(Current->Data.Aktion.Sequence,attr[i+1],NAMELEN) ; } ; if ((strcmp(attr[i],"autonom")==0)||(strcmp(attr[i],"standalone")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Aktion.StandAlone)) ; } ; if ((strcmp(attr[i],"kurz")==0)||(strcmp(attr[i],"short")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Aktion.Short)) ; } ; if ((strcmp(attr[i],"R")==0)||(strcmp(attr[i],"H")==0)) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.R)) ; } ; if ((strcmp(attr[i],"G")==0)||(strcmp(attr[i],"S")==0)) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.G)) ; } ; if ((strcmp(attr[i],"B")==0)||(strcmp(attr[i],"V")==0)) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.B)) ; } ; if (strcmp(attr[i],"W")==0) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.W)) ; } ; if ((strcmp(attr[i],"dauer")==0)||(strcmp(attr[i],"time")==0)) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.Delay)) ; } ; if ((strcmp(attr[i],"schritt")==0)||(strcmp(attr[i],"step")==0)) { sscanf(attr[i+1],"%hhi",&(Current->Data.Aktion.Step)) ; } ; break ; case N_SENSOR: case N_SENS2: case N_LIGHT: case N_EXTENDED: if ((strcmp(attr[i],"typ")==0)||(strcmp(attr[i],"type")==0)) { Current->Data.Sensor.SensorTyp = FillType(attr[i+1]); } ; if ((strcmp(attr[i],"lang")==0)||(strcmp(attr[i],"long")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Lang)) ; } ; if ((strcmp(attr[i],"ende")==0)||(strcmp(attr[i],"end")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Ende)) ; } ; if (strcmp(attr[i],"reset")==0) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Reset)) ; } ; if ((strcmp(attr[i],"dauer")==0)||(strcmp(attr[i],"time")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Reset)) ; } ; if ((strcmp(attr[i],"intervall")==0)||(strcmp(attr[i],"interval")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Intervall)) ; } ; if ((strcmp(attr[i],"led")==0)||(strcmp(attr[i],"led")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.WSNum)) ; } ; if ((strcmp(attr[i],"virtled")==0)||(strcmp(attr[i],"virtled")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.VirtWSNum)) ; } ; if ((strcmp(attr[i],"power1")==0)||(strcmp(attr[i],"power1")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Power1)) ; } ; if ((strcmp(attr[i],"power2")==0)||(strcmp(attr[i],"power2")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Power2)) ; } ; break ; case N_BAD: if ((strcmp(attr[i],"dauer")==0)||(strcmp(attr[i],"duration")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Sensor.Lang)) ; } ; break ; case N_SHADE: if ((strcmp(attr[i],"lang")==0)||(strcmp(attr[i],"long")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Rollo.Lang)) ; } ; if ((strcmp(attr[i],"kurz")==0)||(strcmp(attr[i],"short")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Rollo.Kurz)) ; } ; if ((strcmp(attr[i],"vertauschen")==0)||(strcmp(attr[i],"swap")==0)) { sscanf(attr[i+1],"%d",&(Current->Data.Rollo.Swap)) ; } ; break ; case N_DELAY: if ((strcmp(attr[i],"zeit")==0)||(strcmp(attr[i],"time")==0)) { sscanf (attr[i+1],"%d",&Time) ; Current->Data.Time.tv_sec = Time/1000 ; Current->Data.Time.tv_usec = Time%1000 * 1000 ; } ; break ; case N_TIMER: if ((strcmp(attr[i],"zeit")==0)||(strcmp(attr[i],"time")==0)) { strncpy(Current->Data.Wert.Wert,attr[i+1],NAMELEN*2) ; } ; if ((strcmp(attr[i],"relativ")==0)||(strcmp(attr[i],"relative")==0)) { if ((strcmp(attr[i+1],"vor aufgang")==0)||(strcmp(attr[i],"before sunrise")==0)) { Current->Value = 1 ; } else if ((strcmp(attr[i+1],"nach aufgang")==0)||(strcmp(attr[i],"after sunrise")==0)) { Current->Value = 2 ; } else if ((strcmp(attr[i+1],"vor untergang")==0)||(strcmp(attr[i],"before sunset")==0)) { Current->Value = 3 ; } else if ((strcmp(attr[i+1],"nach untergang")==0)||(strcmp(attr[i],"after sunset")==0)) { Current->Value = 4 ; } ; } ; break ; case N_CALL: case N_TASK: if ((strcmp(attr[i],"makro")==0)||(strcmp(attr[i],"macro")==0)) { strncpy(Current->Data.UnitName,attr[i+1],NAMELEN*4) ; } ; break ; case N_IF: case N_SET: case N_REPEAT: case N_WAITFOR: case N_ELEMENT: if ((strcmp(attr[i],"objekt")==0)||(strcmp(attr[i],"object")==0)) { strncpy(Current->Data.Wert.UnitName,attr[i+1],NAMELEN*4) ; } ; if ((strcmp(attr[i],"wert")==0)||(strcmp(attr[i],"value")==0)) { strncpy(Current->Data.Wert.Wert,attr[i+1],NAMELEN*2) ; } ; break ; case N_VAR: if ((strcmp(attr[i],"wert")==0)||(strcmp(attr[i],"value")==0)) { sscanf(attr[i+1],"%d",&(Current->Value)) ; } ; break ; case N_LANGUAGE: if ((strcmp(attr[i],"ist")==0)||(strcmp(attr[i],"is")==0)) { switch (attr[i+1][0]) { case 'd': setlocale(LC_TIME,"de_DE") ; break ; default: break ; } ; } ; case N_PORT: if (strcmp(attr[i],"CAN")==0) { strncpy(CAN_PORT,attr[i+1],19) ; sscanf (CAN_PORT,"%d",&CAN_PORT_NUM) ; } ; if (strcmp(attr[i],"WS")==0) { strncpy(WS_PORT,attr[i+1],19) ; sscanf (WS_PORT,"%d",&WS_PORT_NUM) ; } ; if (strcmp(attr[i],"COM")==0) { strncpy(COM_PORT,attr[i+1],19) ; sscanf (COM_PORT,"%d",&COM_PORT_NUM) ; } ; if (strcmp(attr[i],"VOICE")==0) { strncpy(VOICE_PORT,attr[i+1],19) ; sscanf (VOICE_PORT,"%d",&VOICE_PORT_NUM) ; } ; if (strcmp(attr[i],"HTTP")==0) { strncpy(HTTP_PORT,attr[i+1],19) ; sscanf (HTTP_PORT,"%d",&HTTP_PORT_NUM) ; } ; break ; case N_BROADCAST: if (strcmp(attr[i],"IP")==0) { strncpy(CAN_BROADCAST,attr[i+1],NAMELEN-1) ; } ; break ; case N_FIRMWARE: if (strcmp(attr[i],"id")==0) { sscanf(attr[i+1],"%d",&(Current->Value)) ; } ; break ; case N_SEQUENCE: if ((strcmp(attr[i],"file")==0)||(strcmp(attr[i],"datei")==0)) { ReadSequence (Current->Name,(char*)attr[i+1]) ; } ; break ; case N_LOC: if (strcmp(attr[i],"west")==0) { sscanf (attr[i+1],"%lf",&West) ; } ; if ((strcmp(attr[i],"north")==0)||(strcmp(attr[i],"nord")==0)) { sscanf (attr[i+1],"%lf",&North) ; } ; break ; case N_PROGRAM: if (strcmp(attr[i],"port")==0) { sscanf(attr[i+1],"%hhd",&(Current->Data.Program.Port)) ; } ; if (strcmp(attr[i],"data")==0) { Val[0] = '0' ; Val[1] = 'x' ; Val[4] = '\0' ; for (j=0;j<50;j++) Current->Data.Program.Data[j]=0 ; for (j=0;attr[i+1][j]!='\0';j+=2) { Val[2] = attr[i+1][j] ; Val[3] = attr[i+1][j+1] ; sscanf (Val,"%hhx",&(Current->Data.Program.Data[j/2])) ; } ; }; break ; case N_REACT: if ((strcmp(attr[i],"von")==0)||(strcmp(attr[i],"from")==0)) { sscanf(attr[i+1],"%i.%i",&(Current->Data.Reaction.From.Linie), &(Current->Data.Reaction.From.Knoten)) ; } ; if ((strcmp(attr[i],"von_maske")==0)||(strcmp(attr[i],"from_mask")==0)) { sscanf(attr[i+1],"%i.%i",&(Current->Data.Reaction.FromMask.Linie), &(Current->Data.Reaction.FromMask.Knoten)) ; } ; if ((strcmp(attr[i],"nach")==0)||(strcmp(attr[i],"to")==0)) { sscanf(attr[i+1],"%i.%i",&(Current->Data.Reaction.To.Linie), &(Current->Data.Reaction.To.Knoten)) ; } ; if ((strcmp(attr[i],"nach_maske")==0)||(strcmp(attr[i],"to_mask")==0)) { sscanf(attr[i+1],"%i.%i",&(Current->Data.Reaction.ToMask.Linie), &(Current->Data.Reaction.ToMask.Knoten)) ; } ; if ((strcmp(attr[i],"daten")==0)||(strcmp(attr[i],"data")==0)) { for (j=0;j<8;j++) Current->Data.Reaction.Data[j] = 0 ; sscanf(attr[i+1],"%hhi %hhi %hhi %hhi %hhi %hhi %hhi %hhi", &(Current->Data.Reaction.Data[0]),&(Current->Data.Reaction.Data[1]), &(Current->Data.Reaction.Data[2]),&(Current->Data.Reaction.Data[3]), &(Current->Data.Reaction.Data[4]),&(Current->Data.Reaction.Data[5]), &(Current->Data.Reaction.Data[6]),&(Current->Data.Reaction.Data[7])) ; } ; if ((strcmp(attr[i],"daten_maske")==0)||(strcmp(attr[i],"data_mask")==0)) { for (j=0;j<8;j++) Current->Data.Reaction.DataMask[j] = 0 ; sscanf(attr[i+1],"%hhi %hhi %hhi %hhi %hhi %hhi %hhi %hhi", &(Current->Data.Reaction.DataMask[0]),&(Current->Data.Reaction.DataMask[1]), &(Current->Data.Reaction.DataMask[2]),&(Current->Data.Reaction.DataMask[3]), &(Current->Data.Reaction.DataMask[4]),&(Current->Data.Reaction.DataMask[5]), &(Current->Data.Reaction.DataMask[6]),&(Current->Data.Reaction.DataMask[7])) ; } ; break ; default: break ; } ; } // Ueberpruefen auf Semantik // Namensgleichheit for (This=Current->Prev;This!=NULL;This=This->Prev) { if ((strlen(Current->Name)>0)&&(strcmp(This->Name,Current->Name)==0)) { // Name wurde schon verwendet ParseError = 1 ; fprintf (stderr,"Name doppelt verwendet: ") ; for (This=Current;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\n") ; break ; } } ; // Einzelelemente if (Current->Type==N_ADRESS) { if ((This=FindNodeAdress(Haus,Current->Data.Adresse.Linie,Current->Data.Adresse.Knoten,Current->Data.Adresse.Port,Current))!=NULL) { ParseError = 1 ; fprintf (stderr,"Adresse wurde doppelt verwendet: Linie %d, Knoten %d, Port %d\n", Current->Data.Adresse.Linie,Current->Data.Adresse.Knoten,Current->Data.Adresse.Port) ; fprintf (stderr,"Erste Verwendung: ") ; for (;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\nZweite Verwendung: ") ; for (This=Current;This!=NULL;This=This->Parent) fprintf (stderr,"%s ",This->Name) ; fprintf (stderr,"\n") ; } ; // Schauen, ob im Parent schon eine Adresse eingetragen ist; ggf diese ebenfalls // ueberschreiben (Ein Element sollte nur eine Adresse haben...) // Dient auch der Möglichkeit, Makros nachträglich mit einer Adresse zu versehen, // um die Konfiguration von Aktionen im Sensor nicht von der Reihenfolge der Makros // abhaengig zu haben. for (This=Current->Prev;This!=NULL;This=This->Prev) if (This->Type==N_ADRESS) { This->Data.Adresse.Linie = Current->Data.Adresse.Linie ; This->Data.Adresse.Knoten = Current->Data.Adresse.Knoten ; This->Data.Adresse.Port = Current->Data.Adresse.Port ; } ; } ; // Element nachbearbeiten // Makros nummerieren if (Current->Type==N_MACRO) { This = NewChild(Current) ; This->Type = N_ADRESS ; This->Data.Adresse.Linie = 0 ; This->Data.Adresse.Knoten = (MakroNummer>>8)+50 ; This->Data.Adresse.Port = (MakroNummer&0xFF) ; MakroNummer++ ; } ;