示例#1
0
void
_SoNurbsSurfaceEvaluator::bgnqstrip( void )
{
    glBegin(GL_TRIANGLES);
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
        map->startNewTriStrip();
}
示例#2
0
//initmappath is a dirname and mapPath is a filename
bool Map::saveIniMap(QString initmapPath, QList<MapImformations> inputMapImformation)
{
	QFile file(initmapPath);
	bool ok = true;
	if(!file.open(QIODevice::WriteOnly))
	{
		QMessageBox::warning(NULL,tr("Saving initial settings"),tr("failed to save settings"));
		return false;
	}
	QDataStream out(&file);
	out.setVersion(QDataStream::Qt_4_8);

	out << quint32(ini_MagicNum);
	out<< quint8(inputMapImformation.size());
	for(int i = 0; i < inputMapImformation.size(); i++) {
		if (isMap(inputMapImformation[i].filePath)) {
			ok = false;
			continue;
		}
		out << inputMapImformation[i].filePath;
		out << quint32(inputMapImformation[i].spawnPoint.ry())
		    << quint32(inputMapImformation[i].spawnPoint.ry());
	}
	return ok;
}
void desserializeMapResult(void *buffer, size_t offset, t_job *job) {
	bool result;
	uint16_t idMap;
	void *bufferOffset = buffer + offset;
	memcpy(&result, bufferOffset, sizeof(result));
	bufferOffset += sizeof(result);
	memcpy(&idMap, bufferOffset, sizeof(idMap));

	free(buffer);

	idMap = ntohs(idMap);

	bool findMap(t_map *map) {
		return isMap(map, idMap);
	}
	t_map *map = list_find(job->maps, (void *) findMap);
	uint16_t cantMaps = list_size(job->maps);
	log_info(logger, "|JOB %d| Map(%d/%d): %d Done on Node: %s -> Result: %d",
			job->id, job->mapsDone, cantMaps, map->id, map->nodeName, result);
	removeMapNode(map);
	if (result) {
		map->done = true;
		job->mapsDone++;
	} else {
		pthread_mutex_lock(&Mnodes);
		deactivateNode(map->nodeName);
		pthread_mutex_unlock(&Mnodes);
		if (!rePlanMap(job, map))
			notifFileUnavailable(job);
	}
}
示例#4
0
文件: vim.c 项目: Cognoscan/ctags
static boolean parseVimLine (const unsigned char *line)
{
	boolean readNextLine = TRUE;

	if ( (!strncmp ((const char*) line, "comp", (size_t) 4) == 0) && 
			(!strncmp ((const char*) line, "comc", (size_t) 4) == 0) && 
			(strncmp ((const char*) line, "com", (size_t) 3) == 0) )
	{
		readNextLine = parseCommand(line);
		/* TODO - Handle parseCommand returning FALSE */
	}

	if (isMap(line))
	{
		parseMap(line);
	}

	if (strncmp ((const char*) line, "fu", (size_t) 2) == 0)
	{
		parseFunction(line);
	}

	if	(strncmp ((const char*) line, "aug", (size_t) 3) == 0)
	{
		parseAutogroup(line);
	}

	if ( strncmp ((const char*) line, "let", (size_t) 3) == 0 )
	{
		parseLet(line);
	}

	return readNextLine;
}
示例#5
0
void
_SoNurbsSurfaceEvaluator::bgnclosedline( void )
{
    glBegin(GL_LINE_LOOP);
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
        map->startNewTriStrip();
}
示例#6
0
文件: vim.c 项目: Monits/ctags
static boolean parseVimLine (const unsigned char *line, int infunction)
{
	boolean readNextLine = TRUE;

	if (wordMatchLen (line, "command", 3))
	{
		readNextLine = parseCommand(line);
		/* TODO - Handle parseCommand returning FALSE */
	}

	else if (isMap(line))
	{
		parseMap(skipWord(line));
	}

	else if (wordMatchLen (line, "function", 2))
	{
		parseFunction(skipWord(line));
	}

	else if	(wordMatchLen (line, "augroup", 3))
	{
		parseAutogroup(skipWord(line));
	}

	else if (wordMatchLen (line, "let", 3))
	{
		parseLet(skipWord(line), infunction);
	}

	return readNextLine;
}
示例#7
0
Map&
Value::toMap()
{
    if (not isMap()) {
        throw utils::CastError(_("Value is not a map"));
    }
    return static_cast<Map&>(*this);
}
示例#8
0
void
_SoNurbsSurfaceEvaluator::setv( REAL v, int index )
{
    valid[index][0] = valid[index][1] = 0;
    vvals[index] = v;

    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) ) 
  map->setv( v, index );
}
示例#9
0
/*-------------------------------------------------------------------------
 * bgnmap2f - preamble to surface definition and evaluations
 *-------------------------------------------------------------------------
 */
void
_SoNurbsSurfaceEvaluator::bgnmap2f( long )
{
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
  map->disable();
    lru = 0;
    vvals[0] = vvals[1] = vvals[2] =*(REAL *)(& NaN);
    validreset();
}
示例#10
0
const WFMath::Polygon<2> PolygonAdapter::getShape()
{
	if (mPolygon) {
		return mPolygon->getShape();
	}
	auto element = getChangedElement();
	if (element.isMap() || element.isList()) {
		return WFMath::Polygon<2>(element);
	}
	return WFMath::Polygon<2>();
}
示例#11
0
bool Map::readIniMapFile() // Path is a initmap file name
{
	QFile file(iniMapFileName[0]);
	if(!file.open(QIODevice::ReadOnly))
	{
		QMessageBox::warning(NULL,tr("Saving initial settings"),tr("failed to read settings"));
		return false;
	}
	QDataStream in(&file);
	in.setVersion(QDataStream::Qt_4_8);
	{
		quint32 magicnum;
		in >> magicnum;
		if (magicnum != Map::ini_MagicNum) {
			return false;
		}
	}
	//How many maps are there
	quint8 tempMapCount;
	in >> tempMapCount;

	quint32 spawnRowT, spawnColoumnT;
	for (int i = 0; i < tempMapCount; ++i) {
		QString mapFloorPath;
		MapImformations spawnT;			//T means temp

		in >> mapFloorPath;
		if (isMap(mapFloorPath)) {
			spawnT.filePath.append(mapFloorPath);
			mapCount++;
		} else {
			quint32 garbage;
			in >> garbage >> garbage;
			continue;
		}
		in >> spawnRowT >> spawnColoumnT;
		spawnT.spawnPoint.setX(spawnColoumnT);
		spawnT.spawnPoint.setY(spawnRowT);
		spawnT.floor = mapCount - 1;
		mapImform.append(spawnT);
	}
	return true;
}
示例#12
0
/*-------------------------------------------------------------------------
 * compute - output cached point or evaluate point and output
 *-------------------------------------------------------------------------
 */
void
_SoNurbsSurfaceEvaluator::compute( REAL *domain, int index, int place )
{
    assert( vvals[index] == domain[1] );
    if( ((place >= valid[index][0]) && (place < valid[index][1])) ) {
  assert( place != 0 );
  for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
      map->output( domain, index, place );
    } else {
  if( place >= MAXCACHED ) {
      place = 0;
  } else if( place == valid[index][1] ) {
      valid[index][1]++;
  } else if( valid[index][0] == valid[index][1] ) {
      valid[index][0] = place;
      valid[index][1] = place+1;
  } else if( place == valid[index][0]-1 ) {
      valid[index][0]--;
  }
  mapeval( domain, index, place );
    }
}
示例#13
0
std::string CborValue::inspect() const
{
    if( isNull() )
    {
        static std::string null = "(null)";
        return null;
    }
    else if( isUndefined() )
    {
        static std::string undefined = "(undefined)";
        return undefined;
    }
    else if( isBool() )
    {
        return boost::lexical_cast<std::string>(toBool());
    }
    else if( isPositiveInteger() )
    {
        return boost::lexical_cast<std::string>(toPositiveInteger());
    }
    else if( isNegativeInteger() )
    {
        std::string result = "-";
        const char specialValue[] = "18446744073709551616"; // 0x10000000000000000
        uint64_t value = toNegativeInteger();

        if( value == 0 )
            result += specialValue;
        else
            result += boost::lexical_cast<std::string>(value);

        return result;
    }
    else if( isDouble() )
    {
        return boost::lexical_cast<std::string>(toDouble());
    }
    else if( isString() )
    {
        return toString();
    }
    else if( isByteString() )
    {
        std::vector<char> byteString = toByteString();
        std::string result = "(0x";

        static const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                                     'A', 'B', 'C', 'D', 'E', 'F'};

        for(size_t i = 0; i < byteString.size(); ++i)
        {
            unsigned char c = static_cast<unsigned char>(byteString[i]);

            result += hex[c / sizeof(hex)];
            result += hex[c % sizeof(hex)];
        }

        result += ')';
        return result;
    }
    else if( isArray() )
    {
        std::vector<CborValue> values = toArray();
        std::string result = "[";

        if( values.empty() == false )
        {
            for(size_t i = 0; i < values.size(); ++i)
            {
                result += values[i].inspect();
                result += ", ";
            }

            result.resize(result.size() - 1);
            result[result.size() - 1] = ']';
        }
        else
        {
            result += ']';
        }

        return result;
    }
    else if( isMap() )
    {
        std::map<CborValue, CborValue> values = toMap();
        std::string result = "{";

        if( values.empty() == false )
        {
            std::map<CborValue, CborValue>::iterator it = values.begin();
            std::map<CborValue, CborValue>::iterator end = values.end();

            for(; it != end; ++it)
            {
                result += it->first.inspect();
                result += ": ";
                result += it->second.inspect();
                result += ", ";
            }

            result.resize(result.size() - 1);
            result[result.size() - 1] = '}';
        }
        else
        {
            result += '}';
        }

        return result;
    }
    else if( isBigInteger() )
    {
        BigInteger bigInteger = toBigInteger();
        std::string result;

        if( bigInteger.positive )
            result = "(big integer: 0x";
        else
            result = "(negative big integer: 0x";

        static const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                                     'A', 'B', 'C', 'D', 'E', 'F'};

        if( bigInteger.bigint.empty() == false )
        {
            for(size_t i = 0; i < bigInteger.bigint.size(); ++i)
            {
                unsigned char c = static_cast<unsigned char >(bigInteger.bigint[i]);

                result += hex[c / sizeof(hex)];
                result += hex[c % sizeof(hex)];
            }

            result.resize(result.size() - 1);
            result[result.size() - 1] = ')';
        }
        else
        {
            result += ')';
        }

        return result;
    }

    assert(false);
    std::string invalidType = "(invalid type)";
    return invalidType;
}
示例#14
0
const CBORValue::MapValue& CBORValue::getMap() const
{
    ASSERT(isMap());
    return m_mapValue;
}
示例#15
0
bool Map::loadMap()
{
	QFile file;
	for(int i = 0; i < mapImform.size(); i++)
	{
		if (!isMap(mapImform[i].filePath)) {
			return false;
		}

		file.setFileName(mapImform[i].filePath);
		if(!file.open(QIODevice::ReadOnly))
		{
			QMessageBox::warning(NULL,tr("Map editor"),
					     tr("failed to read file %1:\n%2")
					     .arg(file.fileName())
					     .arg(file.errorString()));
			return false;
		}

		//添加新层
		DoublemapBlockList newFloor;
		map.append(newFloor);


		QDataStream in(&file);
		in.setVersion(QDataStream::Qt_4_8);
		{
			quint32 magic;		//magic is garbage
			in >> magic;
		}
		quint32 totalColumn = 0;
		int columnIndex = 0;
		int rowIndex = 0;
		mapBlcok block;
		{
			quint32 tmp;
			in >> tmp;				//抛弃垃圾值
		}
		in >> totalColumn;
		//Get spawn point
		//		{
		//			quint32 spawn_row,spawn_column;
		//			in >> spawn_row >> spawn_column;
		//			spawnPoint.append(QPoint(spawn_column, spawn_row));

		//		}
		{
			QList<mapBlcok> newRow;
			map[i].append(newRow);
		}
		quint32 tmp;
		while(!in.atEnd())
		{
			if(columnIndex == (int)totalColumn)			//检查是否要换行
			{
				QList<mapBlcok> newRow;
				map[i].append(newRow);
				rowIndex++;
				columnIndex = 0;
			}
			in >> tmp >> tmp;			//抛弃垃圾值
			in >> block.id >> block.status;
			map[i][rowIndex].append(block);
			columnIndex++;
		}
		file.close();
	}
	return true;
}
示例#16
0
void
_SoNurbsSurfaceEvaluator::swaptmesh( void )
{
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
        map->swapTriStripVertices();
}
示例#17
0
void
_SoNurbsSurfaceEvaluator::mapeval( REAL *domain, int index, int place )
{
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
  map->mapeval( domain, index, place );
}
示例#18
0
/*-------------------------------------------------------------------------
 * endmap2f - postamble to a map
 *-------------------------------------------------------------------------
 */
void
_SoNurbsSurfaceEvaluator::endmap2f( void )
{
    for( _SoNurbsSurfaceMap *map = firstMap(); isMap( map ); map = nextMap(map) )
  map->disable();
}