Пример #1
0
flag TE_KFact::ValidateData(ValidateDataBlk & VDB)
  {
  KConst.SetVal(iType==TT_Branch ? 50.0 : 10.0, this);
  KConst.SetVal(ValidateRange(VDB, "KConst", 0.001, KConst.Val(), 1000.0), this);
  if (Valid(m_PhD.KFact.Ovr()))
    m_PhD.KFact.SetOvr(ValidateRange(VDB, "K", 0.0, m_PhD.KFact.Ovr(), 1.0E6), this);
  return True;
  }
Пример #2
0
void
WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen,
                           const void* data) const
{
    if (!ValidateRange(dstByteOffset, dataLen))
        return;

    if (!CheckedInt<GLintptr>(dataLen).isValid())
        return mContext->ErrorOutOfMemory("Size too large.");

    ////

    const void* uploadData = data;
    if (mIndexCache) {
        const auto cachedDataBegin = (uint8_t*)mIndexCache.get() + dstByteOffset;
        memcpy(cachedDataBegin, data, dataLen);
        uploadData = cachedDataBegin;

        InvalidateCacheRange(dstByteOffset, dataLen);
    }

    ////

    const auto& gl = mContext->gl;
    const ScopedLazyBind lazyBind(gl, target, this);

    gl->fBufferSubData(target, dstByteOffset, dataLen, uploadData);

    ResetLastUpdateFenceId();
}
Пример #3
0
flag VLL_Sep::ValidateData(ValidateDataBlk & VDB)
  {
  H2ORemEff = ValidateRange(VDB, "H2ORemEff", 0.0, H2ORemEff, 1.0);

  SetVLEMixFrac(H2oSettled);
  return FlashTank::ValidateData(VDB);
  };
Пример #4
0
bool UnformatImage (const std::string &path, Range range)
{
	auto disk = std::make_shared<Disk>();
	if (!ReadImage(path, disk))
		return false;

	ValidateRange(range, MAX_TRACKS, MAX_SIDES, disk->cyls(), disk->heads());

	range.each([&] (const CylHead &cylhead) {
		if (!g_fAbort)
			disk->write_track(cylhead, Track());
	});

	return WriteImage(path, disk);
}
Пример #5
0
bool CreateImage (const std::string &path, Range range)
{
	auto disk = std::make_shared<Disk>();

	// Start with legacy default formats, with automatic gap 3
	Format fmt = IsFileExt(path, "cpm") ? RegularFormat::ProDos : RegularFormat::MGT;
	fmt.gap3 = 0;

	// Allow everything about the format to be overridden, but check it
	fmt.Override(true);
	fmt.Validate();
	ValidateRange(range, MAX_TRACKS, MAX_SIDES);

	// Set the disk label, if supplied
	if (!opt.label.empty())
		disk->metadata["label"] = opt.label;

	// Extend or format the disk
	if (opt.noformat)
		disk->write_track(CylHead(range.cyl_end - 1, range.head_end - 1), Track());
	else
		disk->format(fmt);

	// Write to the output disk image
	WriteImage(path, disk);

	// Report the new disk parameters, unless it's already been displayed (raw)
	if (!IsFileExt(path, "raw"))
	{
		auto cyls = disk->cyls();
		auto heads = disk->heads();

		if (opt.noformat)
			util::cout << util::fmt("Created %2u cyl%s, %u head%s, unformatted.\n", cyls, (cyls == 1) ? "" : "s", heads, (heads == 1) ? "" : "s");
		else
		{
			util::cout << util::fmt("Created %2u cyl%s, %u head%s, %2u sector%s/track, %4u bytes/sector\n",
									cyls, (cyls == 1) ? "" : "s", heads, (heads == 1) ? "" : "s",
									fmt.sectors, (fmt.sectors == 1) ? "" : "s", fmt.sector_size());
		}
	}

	return true;
}
Пример #6
0
flag PE_KFact::ValidateData(ValidateDataBlk & VDB)
  {
  m_PhD.KFact.SetVal(ValidateRange(VDB, "K", 0.0, m_PhD.KFact.Val(), 1.0E6), this);
  return True;
  }