static void assignConfiguration(ShovelerViewTileSpriteAnimationConfiguration *destination, const ShovelerViewTileSpriteAnimationConfiguration *source)
{
	clearConfiguration(destination);

	destination->tileSpriteEntityId = source->tileSpriteEntityId;
	destination->moveAmountThreshold = source->moveAmountThreshold;
}
Exemple #2
0
static void freeComponent(ShovelerViewComponent *component, void *componentDataPointer)
{
	ComponentData *componentData = componentDataPointer;

	shovelerTextureFree(componentData->texture);

	free(componentData->collidingTiles);

	clearConfiguration(&componentData->configuration);
	free(componentData);
}
Exemple #3
0
static void freeComponent(ShovelerViewComponent *component, void *componentDataPointer)
{
	ComponentData *componentData = componentDataPointer;

	clearConfiguration(&componentData->configuration);

	shovelerChunkFree(componentData->chunk);
	shovelerCollider2Free(componentData->collider);

	free(componentData);
}
Exemple #4
0
RETSIGTYPE quit(int s)
{
	(void)s;
	/* Obey the request, but first flush the log */
	if (logFile) {
		fclose(logFile);
	}
	/* ...and get rid of memory allocations */
	setConnectionCount(0);
	clearConfiguration();
	exit(0);
}
Exemple #5
0
RETSIGTYPE hup(int s)
{
	(void)s;
	syslog(LOG_INFO, "Received SIGHUP, reloading configuration...");
	/* Learn the new rules */
	clearConfiguration();
	readConfiguration();
#if !HAVE_SIGACTION
	/* And reinstall the signal handler */
	signal(SIGHUP, hup);
#endif
}
Exemple #6
0
static void assignConfiguration(ShovelerViewChunkConfiguration *destination, const ShovelerViewChunkConfiguration *source)
{
	clearConfiguration(destination);

	destination->positionMappingX = source->positionMappingX;
	destination->positionMappingY = source->positionMappingY;
	destination->size = source->size;
	destination->collider = source->collider;
	destination->numLayers = source->numLayers;
	destination->layers = malloc(destination->numLayers * sizeof(ShovelerViewChunkLayerConfiguration));
	memcpy(destination->layers, source->layers, destination->numLayers * sizeof(ShovelerViewChunkLayerConfiguration));
}
static void freeComponent(ShovelerViewComponent *component, void *componentDataPointer)
{
	ComponentData *componentData = componentDataPointer;

	shovelerTileSpriteAnimationFree(componentData->animation);

	if(componentData->positionCallback != NULL) {
		shovelerViewEntityRemoveCallback(component->entity, shovelerViewPositionComponentName, componentData->positionCallback);
	}

	clearConfiguration(&componentData->configuration);
	free(componentData);
}
Exemple #8
0
static void assignConfiguration(ShovelerViewTilemapTilesConfiguration *destination, const ShovelerViewTilemapTilesConfiguration *source)
{
	clearConfiguration(destination);

	destination->isImageResourceEntityDefinition = source->isImageResourceEntityDefinition;
	destination->imageResourceEntityId = source->imageResourceEntityId;
	destination->numColumns = source->numColumns;
	destination->numRows = source->numRows;

	if(!source->isImageResourceEntityDefinition) {
		destination->tiles = malloc(destination->numColumns * destination->numRows * sizeof(ShovelerViewTilemapTilesTileConfiguration));
		memmove(destination->tiles, source->tiles, destination->numColumns * destination->numRows * sizeof(ShovelerViewTilemapTilesTileConfiguration));
	}
}
    void
    Mci::initialise(mci::CardSlot_t cardSlot)
    {
      OSDeviceDebug::putString("avr32::uc3::Mci::initialise()");
      OSDeviceDebug::putNewLine();

      m_shadowStatusRegister = 0;

      softwareReset();
      disableInterface();

      disableAllInterrupts();

      clearConfiguration();
      clearModeBits();

      // Set the Data Timeout Register to 1 Mega Cycles
      initDataTimeout(MCI_DEFAULT_DTOLMUL, MCI_DEFAULT_DTOLCYC);

      // Start with low speed
      configureClockFrequencyHz(400000);

      // Set the Mode register
      // The two bits, Read Proof Enable and Write Proof Enable in the
      // MR register (MR.RDPROOF and MR.WRPROOF) allow stopping the
      // MCI Clock (CLK) during read or write access if the internal
      // FIFO is full. This will guarantee data integrity, not bandwidth
      enableModeBits(
          (MCI_DEFAULT_PWSDIV << AVR32_MCI_MR_PWSDIV)
              | AVR32_MCI_MR_RDPROOF_MASK | AVR32_MCI_MR_WRPROOF_MASK);

      // Set the SD/MMC Card register
      // Start with bus width = 1bit
      configureSdCardBusWidthAndSlot(mci::BusWidth::_1bit, cardSlot);

      // Enable the MCI and the Power Saving
      // The Power Save Mode Enable bit in the CR register (CR.PWSEN)
      // saves power by dividing the MCI clock (CLK) by 2PWSDIV + 1
      // when the bus is inactive. The Power Saving Divider field locates
      // in the Mode Register (MR.PWSDIV).
      enableInterface();
    }
Exemple #10
0
void SyntaxHighlighter::loadConfiguration(const QString &filename)
{
	if(filename!="")
	{
		attribs_map attribs;
		QString elem, expr_type, group;
		bool groups_decl=false, chr_sensitive=false,
				bold=false, italic=false,
				underline=false, partial_match=false;
		QTextCharFormat format;
		QRegExp regexp;
		QColor bg_color, fg_color;
		vector<QString>::iterator itr, itr_end;

		try
		{
			clearConfiguration();
			XMLParser::restartParser();
			XMLParser::setDTDFile(GlobalAttributes::CONFIGURATIONS_DIR +
														GlobalAttributes::DIR_SEPARATOR +
														GlobalAttributes::OBJECT_DTD_DIR +
														GlobalAttributes::DIR_SEPARATOR +
														GlobalAttributes::CODE_HIGHLIGHT_CONF +
														GlobalAttributes::OBJECT_DTD_EXT,
														GlobalAttributes::CODE_HIGHLIGHT_CONF);

			XMLParser::loadXMLFile(filename);

			if(XMLParser::accessElement(XMLParser::CHILD_ELEMENT))
			{
				do
				{
					if(XMLParser::getElementType()==XML_ELEMENT_NODE)
					{
						elem=XMLParser::getElementName();

						if(elem==ParsersAttributes::WORD_SEPARATORS)
						{
							XMLParser::getElementAttributes(attribs);
							word_separators=attribs[ParsersAttributes::VALUE];
						}
						else if(elem==ParsersAttributes::WORD_DELIMITERS)
						{
							XMLParser::getElementAttributes(attribs);
							word_delimiters=attribs[ParsersAttributes::VALUE];
						}
						else if(elem==ParsersAttributes::IGNORED_CHARS)
						{
							XMLParser::getElementAttributes(attribs);
							ignored_chars=attribs[ParsersAttributes::VALUE];
						}
						else if(elem==ParsersAttributes::COMPLETION_TRIGGER)
						{
							XMLParser::getElementAttributes(attribs);

							if(attribs[ParsersAttributes::VALUE].size() >= 1)
								completion_trigger=attribs[ParsersAttributes::VALUE].at(0);
						}

						/*	If the element is what defines the order of application of the groups
								highlight in the (highlight-order). Is in this block that are declared
								the groups used to highlight the source code. ALL groups
								in this block must be declared before they are built
								otherwise an error will be triggered. */
						else if(elem==ParsersAttributes::HIGHLIGHT_ORDER)
						{
							//Marks a flag indication that groups are being declared
							groups_decl=true;
							XMLParser::savePosition();
							XMLParser::accessElement(XMLParser::CHILD_ELEMENT);
							elem=XMLParser::getElementName();
						}

						if(elem==ParsersAttributes::GROUP)
						{
							XMLParser::getElementAttributes(attribs);
							group=attribs[ParsersAttributes::NAME];

							/* If the parser is on the group declaration block and not in the build block
								 some validations are made. */
							if(groups_decl)
							{
								//Raises an error if the group was declared before
								if(find(groups_order.begin(), groups_order.end(), group)!=groups_order.end())
								{
									throw Exception(Exception::getErrorMessage(ERR_REDECL_HL_GROUP).arg(group),
																	ERR_REDECL_HL_GROUP,__PRETTY_FUNCTION__,__FILE__,__LINE__);
								}
								//Raises an error if the group is being declared and build at the declaration statment (not permitted)
								else if(attribs.size() > 1 || XMLParser::hasElement(XMLParser::CHILD_ELEMENT))
								{
									throw Exception(Exception::getErrorMessage(ERR_DEF_INV_GROUP_DECL)
																	.arg(group).arg(ParsersAttributes::HIGHLIGHT_ORDER),
																	ERR_REDECL_HL_GROUP,__PRETTY_FUNCTION__,__FILE__,__LINE__);
								}

								groups_order.push_back(group);
							}
							//Case the parser is on the contruction block and not in declaration of groups
							else
							{
								//Raises an error if the group is being constructed by a second time
								if(initial_exprs.count(group)!=0)
								{
									throw Exception(Exception::getErrorMessage(ERR_DEF_DUPLIC_GROUP).arg(group),
																	ERR_DEF_DUPLIC_GROUP,__PRETTY_FUNCTION__,__FILE__,__LINE__);
								}
								//Raises an error if the group is being constructed without being declared
								else if(find(groups_order.begin(), groups_order.end(), group)==groups_order.end())
								{
									throw Exception(Exception::getErrorMessage(ERR_DEF_NOT_DECL_GROUP)
																	.arg(group).arg(ParsersAttributes::HIGHLIGHT_ORDER),
																	ERR_DEF_NOT_DECL_GROUP,__PRETTY_FUNCTION__,__FILE__,__LINE__);
								}
								//Raises an error if the group does not have children element
								else if(!XMLParser::hasElement(XMLParser::CHILD_ELEMENT))
								{
									throw Exception(Exception::getErrorMessage(ERR_DEF_EMPTY_GROUP).arg(group),
																	ERR_DEF_EMPTY_GROUP,__PRETTY_FUNCTION__,__FILE__,__LINE__);
								}

								chr_sensitive=(attribs[ParsersAttributes::CASE_SENSITIVE]==ParsersAttributes::_TRUE_);
								italic=(attribs[ParsersAttributes::ITALIC]==ParsersAttributes::_TRUE_);
								bold=(attribs[ParsersAttributes::BOLD]==ParsersAttributes::_TRUE_);
								underline=(attribs[ParsersAttributes::UNDERLINE]==ParsersAttributes::_TRUE_);
								partial_match=(attribs[ParsersAttributes::PARTIAL_MATCH]==ParsersAttributes::_TRUE_);
								fg_color.setNamedColor(attribs[ParsersAttributes::FOREGROUND_COLOR]);

								//If the attribute isn't defined the bg color will be transparent
								if(attribs[ParsersAttributes::BACKGROUND_COLOR].isEmpty())
								 bg_color.setRgb(0,0,0,0);
								else
								 bg_color.setNamedColor(attribs[ParsersAttributes::BACKGROUND_COLOR]);

								if(!attribs[ParsersAttributes::LOOKAHEAD_CHAR].isEmpty())
									lookahead_char[group]=attribs[ParsersAttributes::LOOKAHEAD_CHAR][0];

								format.setFontItalic(italic);
								format.setFontUnderline(underline);

								if(bold)
									format.setFontWeight(QFont::Bold);
								else
									format.setFontWeight(QFont::Normal);

								format.setForeground(fg_color);
								format.setBackground(bg_color);
								formats[group]=format;


								XMLParser::savePosition();
								XMLParser::accessElement(XMLParser::CHILD_ELEMENT);

								if(chr_sensitive)
									regexp.setCaseSensitivity(Qt::CaseSensitive);
								else
									regexp.setCaseSensitivity(Qt::CaseInsensitive);

								this->partial_match[group]=partial_match;

								do
								{
									if(XMLParser::getElementType()==XML_ELEMENT_NODE)
									{
										XMLParser::getElementAttributes(attribs);
										expr_type=attribs[ParsersAttributes::TYPE];
										regexp.setPattern(attribs[ParsersAttributes::VALUE]);

										if(attribs[ParsersAttributes::REGULAR_EXP]==ParsersAttributes::_TRUE_)
											regexp.setPatternSyntax(QRegExp::RegExp2);
										else if(attribs[ParsersAttributes::WILDCARD]==ParsersAttributes::_TRUE_)
											regexp.setPatternSyntax(QRegExp::Wildcard);
										else
											regexp.setPatternSyntax(QRegExp::FixedString);

										if(expr_type=="" ||
											 expr_type==ParsersAttributes::SIMPLE_EXP ||
											 expr_type==ParsersAttributes::INITIAL_EXP)
											initial_exprs[group].push_back(regexp);
										else
											final_exprs[group].push_back(regexp);
									}
								}
								while(XMLParser::accessElement(XMLParser::NEXT_ELEMENT));
								XMLParser::restorePosition();
							}
						}
					}

					/* Check if there are some other groups to be declared, if not,
							continues to reading to the other part of configuration */
					if(groups_decl && !XMLParser::hasElement(XMLParser::NEXT_ELEMENT))
					{
						groups_decl=false;
						XMLParser::restorePosition();
					}

				}
				while(XMLParser::accessElement(XMLParser::NEXT_ELEMENT));
			}

			itr=groups_order.begin();
			itr_end=groups_order.end();

			while(itr!=itr_end)
			{
				group=(*itr);
				itr++;

				if(initial_exprs[group].size()==0)
				{
					//Raises an error if the group was declared but not constructed
					throw Exception(Exception::getErrorMessage(ERR_GROUP_DECL_NOT_DEFINED).arg(group),
													ERR_GROUP_DECL_NOT_DEFINED,__PRETTY_FUNCTION__,__FILE__,__LINE__);
				}
			}

			conf_loaded=true;
		}
		catch(Exception &e)
		{
			throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
		}
	}
}