bool detexDecompressBlockBPTC_SIGNED_FLOAT(const uint8_t * DETEX_RESTRICT bitstring,
uint32_t mode_mask, uint32_t flags, uint8_t * DETEX_RESTRICT pixel_buffer) {
	return DecompressBlockBPTCFloatShared(bitstring, mode_mask, flags, true,
		pixel_buffer);
}

/* Decompress a 128-bit 4x4 pixel texture block compressed using the */
/* BPTC_FLOAT (BC6H_FLOAT) format. The output format is */
/* DETEX_PIXEL_FORMAT_SIGNED_FLOAT_RGBX16. */


void BlockATI1::flip4()
{
	alpha.flip4();
}


void
TileWorkQueue::clampToPass(unsigned passIdx)
{
    MNRY_ASSERT(mNumPasses);
    passIdx = std::min(passIdx, mNumPasses - 1u);
    mGroupClampIdx = mPassInfos[passIdx].mEndGroupIdx;
}

// Executes the up until and including this pass and then stops.


CharIterator::CharIterator ()
{
   it = NULL;
}


void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url)
{
   static Fl_Menu_Item pm[] = {
      {"Validate URL with W3C", 0, Menu_bugmeter_validate_w3c_cb,0,0,0,0,0,0},
      {"Validate URL with WDG", 0, Menu_bugmeter_validate_wdg_cb, 0,
       FL_MENU_DIVIDER,0,0,0,0},
      {"About bug meter", 0, Menu_bugmeter_about_cb,0,0,0,0,0,0},
      {0,0,0,0,0,0,0,0,0}
   };

   popup_x = Fl::event_x();
   popup_y = Fl::event_y();
   popup_bw = bw;
   a_Url_free(popup_url);
   popup_url = a_Url_dup(url);

   a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm);
}

/*
 * Bugmeter popup menu (construction & popup)
 */


bool ClipperBase::PopScanbeam(cInt &Y) {
  if (m_Scanbeam.empty())
    return false;
  Y = m_Scanbeam.top();
  m_Scanbeam.pop();
  while (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) {
    m_Scanbeam.pop();
  } // Pop duplicates.
  return true;
}


void insertAtTail(Node* &tail, int d) {
    Node* temp = new Node(d);
    tail->next = temp;
    tail = temp;
}


int main(int argc, char** argv)
{
    std::vector<std::string> inputFiles;
    std::vector<std::string> outputDirOrFiles;
    std::string              whiteListFile;
    int                      opts;
    int                      verbosity;

    // handle errors by exiting
    spv::spirvbin_t::registerErrorHandler(errHandler);

    // Log messages to std::cout
    spv::spirvbin_t::registerLogHandler(logHandler);

    if (argc < 2)
        usage(argv[0]);

    parseCmdLine(argc, argv, inputFiles, outputDirOrFiles, whiteListFile, opts, verbosity);

    if (outputDirOrFiles.empty())
        usage(argv[0], "Output directory or file(s) required.");

    const bool isMultiInput      = inputFiles.size() > 1;
    const bool isMultiOutput     = outputDirOrFiles.size() > 1;
    const bool isSingleOutputDir = !isMultiOutput && std::filesystem::is_directory(outputDirOrFiles[0]);

    if (isMultiInput && !isMultiOutput && !isSingleOutputDir)
        usage(argv[0], "Output is not a directory.");

    if (isMultiInput && isMultiOutput && (outputDirOrFiles.size() != inputFiles.size()))
        usage(argv[0], "Output must be either a single directory or one output file per input.");

    // Main operations: read, remap, and write.
    execute(inputFiles, outputDirOrFiles, isSingleOutputDir, whiteListFile, opts, verbosity);

    // If we get here, everything went OK!  Nothing more to be done.
}


void TShader::setHlslIoMapping(bool hlslIoMap)          { intermediate->setHlslIoMapping(hlslIoMap); }

// See comment above TDefaultHlslIoMapper in iomapper.cpp:


int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& type, bool& typeCollision)
{
    typeCollision = false;

    int set;
    if (qualifier.isPipeInput())
        set = 0;
    else if (qualifier.isPipeOutput())
        set = 1;
    else if (qualifier.storage == EvqUniform)
        set = 2;
    else if (qualifier.storage == EvqBuffer)
        set = 3;
    else if (qualifier.storage == EvqTileImageEXT)
        set = 4;
    else if (qualifier.isAnyPayload())
        set = 0;
    else if (qualifier.isAnyCallable())
        set = 1;
    else if (qualifier.isHitObjectAttrNV())
        set = 2;
    else
        return -1;

    int size;
    if (qualifier.isAnyPayload() || qualifier.isAnyCallable()) {
        size = 1;
    } else if (qualifier.isUniformOrBuffer() || qualifier.isTaskMemory()) {
        if (type.isSizedArray())
            size = type.getCumulativeArraySize();
        else
            size = 1;
    } else {
        // Strip off the outer array dimension for those having an extra one.
        if (type.isArray() && qualifier.isArrayedIo(language)) {
            TType elementType(type, 0);
            size = computeTypeLocationSize(elementType, language);
        } else
            size = computeTypeLocationSize(type, language);
    }

    // Locations, and components within locations.
    //
    // Almost always, dealing with components means a single location is involved.
    // The exception is a dvec3. From the spec:
    //
    // "A dvec3 will consume all four components of the first location and components 0 and 1 of
    // the second location. This leaves components 2 and 3 available for other component-qualified
    // declarations."
    //
    // That means, without ever mentioning a component, a component range
    // for a different location gets specified, if it's not a vertex shader input. (!)
    // (A vertex shader input will show using only one location, even for a dvec3/4.)
    //
    // So, for the case of dvec3, we need two independent ioRanges.
    //
    // For raytracing IO (payloads and callabledata) each declaration occupies a single
    // slot irrespective of type.
    int collision = -1; // no collision
    if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) {
        TRange range(qualifier.layoutLocation, qualifier.layoutLocation);
        collision = checkLocationRT(set, qualifier.layoutLocation);
        if (collision < 0)
            usedIoRT[set].push_back(range);
        return collision;
    }
    if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
        (qualifier.isPipeInput() || qualifier.isPipeOutput())) {
        // Dealing with dvec3 in/out split across two locations.
        // Need two io-ranges.
        // The case where the dvec3 doesn't start at component 0 was previously caught as overflow.

        // First range:
        TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation);
        TRange componentRange(0, 3);
        TIoRange range(locationRange, componentRange, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat);

        // check for collisions
        collision = checkLocationRange(set, range, type, typeCollision);
        if (collision < 0) {
            usedIo[set].push_back(range);

            // Second range:
            TRange locationRange2(qualifier.layoutLocation + 1, qualifier.layoutLocation + 1);
            TRange componentRange2(0, 1);
            TIoRange range2(locationRange2, componentRange2, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat);

            // check for collisions
            collision = checkLocationRange(set, range2, type, typeCollision);
            if (collision < 0)
                usedIo[set].push_back(range2);
        }
        return collision;
    }

    // Not a dvec3 in/out split across two locations, generic path.
    // Need a single IO-range block.

    TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation + size - 1);
    TRange componentRange(0, 3);
    if (qualifier.hasComponent() || type.getVectorSize() > 0) {
        int consumedComponents = type.getVectorSize() * (type.getBasicType() == EbtDouble ? 2 : 1);
        if (qualifier.hasComponent())
            componentRange.start = qualifier.layoutComponent;
        componentRange.last  = componentRange.start + consumedComponents - 1;
    }

    // combine location and component ranges
    TBasicType basicTy = type.getBasicType();
    if (basicTy == EbtSampler && type.getSampler().isAttachmentEXT())
        basicTy = type.getSampler().type;
    TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0, qualifier.centroid, qualifier.smooth, qualifier.flat);

    // check for collisions, except for vertex inputs on desktop targeting OpenGL
    if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
        collision = checkLocationRange(set, range, type, typeCollision);

    if (collision < 0)
        usedIo[set].push_back(range);

    return collision;
}

// Accumulate locations used for inputs, outputs, and uniforms, payload, callable data, and tileImageEXT
// and check for collisions as the accumulation is done.
//
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
//
// typeCollision is set to true if there is no direct collision, but the types in the same location
// are different.
//


static void SetupGenMidi()
{
	// The OPL renderer should not care about where this comes from.
	// Note: No I_Error here - this needs to be consistent with the rest of the music code.
	auto lump = fileSystem.CheckNumForName("GENMIDI", ns_global);
	if (lump < 0)
	{
		Printf("No GENMIDI lump found. OPL playback not available.\n");
		return;
	}
	auto genmidi = fileSystem.ReadFile(lump);

	if (genmidi.size() < 8 + 175 * 36 || memcmp(genmidi.data(), "#OPL_II#", 8)) return;
	ZMusic_SetGenMidi(genmidi.bytes() + 8);
}


void SoundEngine::UnlinkChannel(FSoundChan *chan)
{
	*(chan->PrevChan) = chan->NextChan;
	if (chan->NextChan != NULL)
	{
		chan->NextChan->PrevChan = chan->PrevChan;
	}
}


void InterplayDecoder::DecodeBlock7(int32_t offset)
{
    uint8_t* pBuffer = GetCurrentFrame() + (intptr_t)offset;
    uint32_t flags = 0;

    uint8_t P[2];
    P[0] = *ChunkPtr++;
    P[1] = *ChunkPtr++;

    // 2-color encoding
    if (P[0] <= P[1])
    {
        // need 8 more bytes from the stream
        for (int y = 0; y < 8; y++)
        {
            flags = (*ChunkPtr++) | 0x100;
            for (; flags != 1; flags >>= 1) {
                *pBuffer++ = P[flags & 1];
            }
            pBuffer += (videoStride - 8);
        }
    }
    else
    {
        // need 2 more bytes from the stream
        flags = LE_16(ChunkPtr);
        ChunkPtr += 2;

        for (int y = 0; y < 8; y += 2)
        {
            for (int x = 0; x < 8; x += 2, flags >>= 1)
            {
                pBuffer[x] =
                    pBuffer[x + 1] =
                    pBuffer[x + videoStride] =
                    pBuffer[x + 1 + videoStride] = P[flags & 1];
            }
            pBuffer += videoStride * 2;
        }
    }
}


static void Atomic()
{
	// Flip current white
	CurrentWhite = OtherWhite();
	SweepPos = &Root;
	State = GCS_Sweep;
	Estimate = AllocBytes;
}


void FDInputMouse::Ungrab()
{
	Device->Unacquire();
	Grabbed = false;
	SetCursorState(true);
	ClearButtonState();
}


void FRawPS2Manager::GetDevices(TArray<IJoystickConfig *> &sticks)
{
	for (unsigned i = 0; i < Devices.Size(); ++i)
	{
		if (Devices[i]->IsConnected())
		{
			sticks.Push(Devices[i]);
		}
	}
}


ExpEmit FxBoolCast::Emit(VMFunctionBuilder *build)
{
	ExpEmit from = basex->Emit(build);

	if(from.Konst && from.RegType == REGT_INT)
	{ // this is needed here because the int const assign optimization returns a constant
		ExpEmit to;
		to.Konst = true;
		to.RegType = REGT_INT;
		to.RegNum = build->GetConstantInt(!!build->FindConstantInt(from.RegNum));
		return to;
	}

	assert(!from.Konst);
	assert(basex->ValueType->GetRegType() == REGT_INT || basex->ValueType->GetRegType() == REGT_FLOAT || basex->ValueType->GetRegType() == REGT_POINTER);

	if (NeedValue)
	{
		ExpEmit to(build, REGT_INT);
		from.Free(build);
		build->Emit(OP_CASTB, to.RegNum, from.RegNum, from.RegType == REGT_INT ? CASTB_I : from.RegType == REGT_FLOAT ? CASTB_F : CASTB_A);
		return to;
	}
	else
	{
		return from;
	}
}


void DStatusBarCore::StatusbarToRealCoords(double& x, double& y, double& w, double& h) const
{
	if (SBarScale.X == -1 || ForcedScale)
	{
		int hres = HorizontalResolution;
		int vres = VerticalResolution;
		ValidateResolution(hres, vres);

		VirtualToRealCoords(twod, x, y, w, h, hres, vres, true, true);
	}
	else
	{
		x = ST_X + x * SBarScale.X;
		y = ST_Y + y * SBarScale.Y;
		w *= SBarScale.X;
		h *= SBarScale.Y;
	}
}


void MD5Context::Final(uint8_t digest[16])
{
	int count = bytes[0] & 0x3f;	/* Number of bytes in ctx->in */
	uint8_t *p = (uint8_t *)in + count;

	/* Set the first char of padding to 0x80.  There is always room. */
	*p++ = 0x80;

	/* Bytes of padding needed to make 56 bytes (-8..55) */
	count = 56 - 1 - count;

	if (count < 0)		/* Padding forces an extra block */
	{
		memset(p, 0, count + 8);
		byteSwap(in, 16);
		MD5Transform(buf, in);
		p = (uint8_t *)in;
		count = 56;
	}
	memset(p, 0, count);
	byteSwap(in, 14);

	/* Append length in bits and transform */
	in[14] = bytes[0] << 3;
	in[15] = (bytes[1] << 3) | (bytes[0] >> 29);
	MD5Transform(buf, in);

	byteSwap(buf, 4);
	memcpy(digest, buf, 16);
	memset(this, 0, sizeof(*this));	/* In case it's sensitive */
}

/*
 * Final wrapup - pad to 64-byte boundary with the bit pattern
 * 1 0* (64-bit count of bits processed, MSB-first)
 */


void FMugShot::Reset()
{
	FaceHealthNow = FaceHealthLast = -1;
	bEvilGrin = false;
	bNormal = true;
	bDamageFaceActive = false;
	bOuchActive = false;
	CurrentState = NULL;
	RampageTimer = 0;
	LastDamageAngle = 1;
}


void DBaseStatusBar::DrawBottomStuff (EHudState state)
{
	primaryLevel->localEventManager->RenderUnderlay(state);
	DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : twod->GetHeight());
}


void FTextureAnimator::UpdateAnimations (uint64_t mstime)
{
	for (unsigned int i = 0; i < mFireTextures.Size(); i++)
	{
		FFireTexture* fire = &mFireTextures[i];
		bool updated = false;

		if (fire->SwitchTime == 0)
		{
			fire->SwitchTime = mstime + fire->Duration;
		}
		else while (fire->SwitchTime <= mstime)
		{
			static_cast<FireTexture*>(fire->texture->GetTexture())->Update();
			fire->SwitchTime = mstime + fire->Duration;
			updated = true;
		}

		if (updated)
		{
			fire->texture->CleanHardwareData();

			if (fire->texture->GetSoftwareTexture())
				delete fire->texture->GetSoftwareTexture();

			fire->texture->SetSoftwareTexture(nullptr);
		}
	}
	for (unsigned int j = 0; j < mAnimations.Size(); ++j)
	{
		FAnimDef *anim = &mAnimations[j];

		// If this is the first time through R_UpdateAnimations, just
		// initialize the anim's switch time without actually animating.
		if (anim->SwitchTime == 0)
		{
			anim->SetSwitchTime (mstime);
		}
		else while (anim->SwitchTime <= mstime)
		{ // Multiple frames may have passed since the last time calling
		  // R_UpdateAnimations, so be sure to loop through them all.

			AdvanceFrame(anim->CurFrame, anim->AnimType, *anim);
			anim->SetSwitchTime (mstime);
		}

		if (anim->bDiscrete)
		{
			TexMan.SetTranslation (anim->BasePic, anim->Frames[anim->CurFrame].FramePic);
		}
		else
		{
			for (unsigned int i = 0; i < anim->NumFrames; i++)
			{
				TexMan.SetTranslation (anim->BasePic + i, anim->BasePic + (i + anim->CurFrame) % anim->NumFrames);
			}
		}
	}
}


void DBaseDecal::SetShade (int r, int g, int b)
{
	AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
}


static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 *posforwindowcheck)
{
	if (line->special && !(mobj->flags6 & MF6_NOTRIGGER))
	{
		if (posforwindowcheck && !(mobj->Level->i_compatflags2 & COMPATF2_PUSHWINDOW) && line->backsector != NULL)
		{ // Make sure this line actually blocks us and is not a window
			// or similar construct we are standing inside of.
			DVector3 pos = mobj->PosRelative(line);
			double fzt = line->frontsector->ceilingplane.ZatPoint(*posforwindowcheck);
			double fzb = line->frontsector->floorplane.ZatPoint(*posforwindowcheck);
			double bzt = line->backsector->ceilingplane.ZatPoint(*posforwindowcheck);
			double bzb = line->backsector->floorplane.ZatPoint(*posforwindowcheck);
			if (fzt >= mobj->Top() && bzt >= mobj->Top() &&
				fzb <= mobj->Z() && bzb <= mobj->Z())
			{
				if (line->flags & ML_3DMIDTEX)
				{
					double top, bot;
					P_GetMidTexturePosition(line, side, &top, &bot);
					if (bot < mobj->Top() && top > mobj->Z())
					{
						goto isblocking;
					}
				}
				// we must also check if some 3D floor in the backsector may be blocking
				for (auto rover : line->backsector->e->XFloor.ffloors)
				{
					if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;

					double ff_bottom = rover->bottom.plane->ZatPoint(*posforwindowcheck);
					double ff_top = rover->top.plane->ZatPoint(*posforwindowcheck);

					if (ff_bottom < mobj->Top() && ff_top > mobj->Z())
					{
						goto isblocking;
					}
				}
				return;
			}
		}
	isblocking:
		if (mobj->flags2 & MF2_PUSHWALL)
		{
			P_ActivateLine(line, mobj, side, SPAC_Push);
		}
		else if (mobj->flags2 & MF2_IMPACT)
		{
			if ((mobj->Level->flags2 & LEVEL2_MISSILESACTIVATEIMPACT) ||
				!(mobj->flags & MF_MISSILE) ||
				(mobj->target == NULL))
			{
				P_ActivateLine(line, mobj, side, SPAC_Impact);
			}
			else
			{
				P_ActivateLine(line, mobj->target, side, SPAC_Impact);
			}
		}
	}
}


bool P_MoveThing(AActor *source, const DVector3 &pos, bool fog)
{
	DVector3 old = source->Pos();

	source->SetOrigin (pos, true);
	if (P_TestMobjLocation (source))
	{
		if (fog)
		{
			P_SpawnTeleportFog(source, pos, false, true);
			P_SpawnTeleportFog(source, old, true, true);
		}
		source->ClearInterpolation();
		source->renderflags |= RF_NOINTERPOLATEVIEW;
		return true;
	}
	else
	{
		source->SetOrigin (old, true);
		return false;
	}
}


bool FPolyObj::CheckMobjBlocking (side_t *sd)
{
	static TArray<AActor *> checker;
	FBlockNode *block;
	AActor *mobj;
	int i, j, k;
	int left, right, top, bottom;
	line_t *ld;
	bool blocked;
	bool performBlockingThrust;
	int bmapwidth = Level->blockmap.bmapwidth;
	int bmapheight = Level->blockmap.bmapheight;

	ld = sd->linedef;

	top = Level->blockmap.GetBlockY(ld->bbox[BOXTOP]);
	bottom = Level->blockmap.GetBlockY(ld->bbox[BOXBOTTOM]);
	left = Level->blockmap.GetBlockX(ld->bbox[BOXLEFT]);
	right = Level->blockmap.GetBlockX(ld->bbox[BOXRIGHT]);

	blocked = false;
	checker.Clear();

	bottom = bottom < 0 ? 0 : bottom;
	bottom = bottom >= bmapheight ? bmapheight-1 : bottom;
	top = top < 0 ? 0 : top;
	top = top >= bmapheight  ? bmapheight-1 : top;
	left = left < 0 ? 0 : left;
	left = left >= bmapwidth ? bmapwidth-1 : left;
	right = right < 0 ? 0 : right;
	right = right >= bmapwidth ?  bmapwidth-1 : right;

	for (j = bottom*bmapwidth; j <= top*bmapwidth; j += bmapwidth)
	{
		for (i = left; i <= right; i++)
		{
			for (block = Level->blockmap.blocklinks[j+i]; block != nullptr; block = block->NextActor)
			{
				mobj = block->Me;
				for (k = (int)checker.Size()-1; k >= 0; --k)
				{
					if (checker[k] == mobj)
					{
						break;
					}
				}
				if (k < 0)
				{
					checker.Push (mobj);
					if ((mobj->flags&MF_SOLID) && !(mobj->flags&MF_NOCLIP))
					{
						FLineOpening open;
						open.top = LINEOPEN_MAX;
						open.bottom = LINEOPEN_MIN;
						// [TN] Check wether this actor gets blocked by the line.
						if (ld->backsector != nullptr && !P_IsBlockedByLine(mobj, ld)
							&& (!(ld->flags & ML_3DMIDTEX) ||
								(!P_LineOpening_3dMidtex(mobj, ld, open) &&
									(mobj->Top() < open.top)
								) || (open.abovemidtex && mobj->Z() > mobj->floorz))
							)
						{
							// [BL] We can't just continue here since we must
							// determine if the line's backsector is going to
							// be blocked.
							performBlockingThrust = false;
						}
						else
						{
							performBlockingThrust = true;
						}

						DVector2 pos = mobj->PosRelative(ld).XY();
						FBoundingBox box(pos.X, pos.Y, mobj->radius);

						if (!inRange(box, ld) || BoxOnLineSide(box, ld) != -1)
						{
							continue;
						}

						if (ld->isLinePortal())
						{
							// Fixme: this still needs to figure out if the polyobject move made the player cross the portal line.
							if (P_TryMove(mobj, mobj->Pos().XY(), false))
							{
								continue;
							}
						}
						// We have a two-sided linedef so we should only check one side
						// so that the thrust from both sides doesn't cancel each other out.
						// Best use the one facing the player and ignore the back side.
						if (ld->sidedef[1] != nullptr)
						{
							int side = P_PointOnLineSidePrecise(mobj->Pos(), ld);
							if (ld->sidedef[side] != sd)
							{
								continue;
							}
							// [BL] See if we hit below the floor/ceiling of the poly.
							else if(!performBlockingThrust && (
									mobj->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
									mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
								))
							{
								performBlockingThrust = true;
							}
						}

						if(performBlockingThrust)
						{
							ThrustMobj (mobj, sd);
							blocked = true;
						}
						else
							continue;
					}
				}
			}
		}
	}
	return blocked;
}


void HWDrawInfo::AddLines(subsector_t * sub, sector_t * sector, FRenderState& state)
{
	currentsector = sector;
	currentsubsector = sub;

	ClipWall.Clock();
	if (sub->polys != nullptr)
	{
		AddPolyobjs(sub, state);
	}
	else
	{
		int count = sub->numlines;
		seg_t * seg = sub->firstline;

		while (count--)
		{
			if (seg->linedef == nullptr)
			{
				if (!(sub->flags & SSECMF_DRAWN)) AddLine (seg, mClipPortal != nullptr, state);
			}
			else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
			{
				AddLine (seg, mClipPortal != nullptr, state);
			}
			seg++;
		}
	}
	ClipWall.Unclock();
}


static int isLinePortal(line_t *self)
 {
	 return self->isLinePortal();
 }


static void ParseActor(FScanner &sc, PNamespace *ns)
{
	PClassActor *info = NULL;
	Baggage bag;

	bag.Namespace = ns;
	bag.Version = { 2, 0, 0 };
	bag.fromDecorate = true;
	bag.ScriptPosition = sc;
	info = ParseActorHeader(sc, &bag);
	sc.MustGetToken('{');
	while (sc.MustGetAnyToken(), sc.TokenType != '}')
	{
		switch (sc.TokenType)
		{
		case TK_Const:
			ParseConstant (sc, &info->VMType->Symbols, info, ns);
			break;

		case TK_Enum:
			ParseEnum (sc, &info->VMType->Symbols, info, ns);
			break;

		case TK_Var:
			ParseUserVariable (sc, &info->VMType->Symbols, info, ns);
			break;

		case TK_Identifier:
			ParseActorProperty(sc, bag);
			break;

		case TK_States:
			ParseStates(sc, bag.Info, (AActor *)bag.Info->Defaults, bag);
			bag.StateSet = true;
			break;

		case '+':
		case '-':
			ParseActorFlag(sc, bag, sc.TokenType);
			break;

		default:
			sc.ScriptError("Unexpected '%s' in definition of '%s'", sc.String, bag.Info->TypeName.GetChars());
			break;
		}
	}
	if (bag.DropItemSet)
	{
		bag.Info->SetDropItems(bag.DropItemList);
	}
	try
	{
		FinalizeClass(info, bag.statedef);
	}
	catch (CRecoverableError &err)
	{
		sc.ScriptError("%s", err.GetMessage());
	}
	sc.SetCMode (false);
}


void S_PrecacheLevel(FLevelLocals* Level)
{
	if (GSnd && Level == primaryLevel)
	{
		soundEngine->MarkAllUnused();

		AActor* actor;
		auto iterator = Level->GetThinkerIterator<AActor>();

		// Precache all sounds known to be used by the currently spawned actors.
		while ((actor = iterator.Next()) != nullptr)
		{
			IFVIRTUALPTR(actor, AActor, MarkPrecacheSounds)
			{
				VMValue params[1] = { actor };
				VMCall(func, params, 1, nullptr, 0);
			}
		}
		for (auto snd : gameinfo.PrecachedSounds)
		{
			soundEngine->MarkUsed(snd);
		}
		// Precache all extra sounds requested by this map.
		for (auto snd : primaryLevel->info->PrecacheSounds)
		{
			soundEngine->MarkUsed(snd);
		}
		soundEngine->CacheMarkedSounds();
	}
}


static uint32_t FastDecodeTag(uint16_t coded_tag) {
  uint32_t result = coded_tag;
  result += static_cast<int8_t>(coded_tag);
  return result >> 1;
}

// On the fast path, a (matching) 2-byte tag always needs to be decoded.


void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)
{
    if (c == 0 && InputQueueSurrogate == 0)
        return;

    if ((c & 0xFC00) == 0xD800) // High surrogate, must save
    {
        if (InputQueueSurrogate != 0)
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        InputQueueSurrogate = c;
        return;
    }

    ImWchar cp = c;
    if (InputQueueSurrogate != 0)
    {
        if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate
        {
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        }
        else
        {
#if IM_UNICODE_CODEPOINT_MAX == 0xFFFF
            cp = IM_UNICODE_CODEPOINT_INVALID; // Codepoint will not fit in ImWchar
#else
            cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);
#endif
        }

        InputQueueSurrogate = 0;
    }
    InputQueueCharacters.push_back(cp);
}

// UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so
// we should save the high surrogate.


void BowVector::saveM(const std::string &filename, size_t W) const
{
  std::fstream f(filename.c_str(), std::ios::out);

  WordId last = 0;
  BowVector::const_iterator bit;
  for(bit = this->begin(); bit != this->end(); ++bit)
  {
    for(; last < bit->first; ++last)
    {
      f << "0 ";
    }
    f << bit->second << " ";

    last = bit->first + 1;
  }
  for(; last < (WordId)W; ++last)
    f << "0 ";

  f.close();
}


void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)
{
    if ((c == 0 && InputQueueSurrogate == 0) || !AppAcceptingEvents)
        return;

    if ((c & 0xFC00) == 0xD800) // High surrogate, must save
    {
        if (InputQueueSurrogate != 0)
            AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID);
        InputQueueSurrogate = c;
        return;
    }

    ImWchar cp = c;
    if (InputQueueSurrogate != 0)
    {
        if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate
        {
            AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID);
        }
        else
        {
#if IM_UNICODE_CODEPOINT_MAX == 0xFFFF
            cp = IM_UNICODE_CODEPOINT_INVALID; // Codepoint will not fit in ImWchar
#else
            cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);
#endif
        }

        InputQueueSurrogate = 0;
    }
    AddInputCharacter((unsigned)cp);
}


void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* parent_window = g.CurrentWindow;
    const int current_stack_size = g.BeginPopupStack.Size;

    if (popup_flags & ImGuiPopupFlags_NoOpenOverExistingPopup)
        if (IsPopupOpen((ImGuiID)0, ImGuiPopupFlags_AnyPopupId))
            return;

    ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
    popup_ref.PopupId = id;
    popup_ref.Window = NULL;
    popup_ref.BackupNavWindow = g.NavWindow;            // When popup closes focus may be restored to NavWindow (depend on window type).
    popup_ref.OpenFrameCount = g.FrameCount;
    popup_ref.OpenParentId = parent_window->IDStack.back();
    popup_ref.OpenPopupPos = NavCalcPreferredRefPos();
    popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;

    IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopupEx(0x%08X)\n", id);
    if (g.OpenPopupStack.Size < current_stack_size + 1)
    {
        g.OpenPopupStack.push_back(popup_ref);
    }
    else
    {
        // Gently handle the user mistakenly calling OpenPopup() every frame. It is a programming mistake! However, if we were to run the regular code path, the ui
        // would become completely unusable because the popup will always be in hidden-while-calculating-size state _while_ claiming focus. Which would be a very confusing
        // situation for the programmer. Instead, we silently allow the popup to proceed, it will keep reappearing and the programming error will be more obvious to understand.
        if (g.OpenPopupStack[current_stack_size].PopupId == id && g.OpenPopupStack[current_stack_size].OpenFrameCount == g.FrameCount - 1)
        {
            g.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.OpenFrameCount;
        }
        else
        {
            // Close child popups if any, then flag popup for open/reopen
            ClosePopupToLevel(current_stack_size, false);
            g.OpenPopupStack.push_back(popup_ref);
        }

        // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow().
        // This is equivalent to what ClosePopupToLevel() does.
        //if (g.OpenPopupStack[current_stack_size].PopupId == id)
        //    FocusWindow(parent_window);
    }
}

// Mark popup as open (toggle toward open state).
// Popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
// Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).
// One open popup per level of the popup hierarchy (NB: when assigning we reset the Window member of ImGuiPopupRef to NULL)


bool Document::isRowHidden(int row)
{
	if (Worksheet *sheet = currentWorksheet())
	   return sheet->isRowHidden(row);
	 return false;
}

/*!
 Returns true if \a row is hidden.
*/


void Worksheet::saveToXmlFile(QIODevice *device) const
{
	Q_D(const Worksheet);
	d->relationships->clear();

	QXmlStreamWriter writer(device);

	writer.writeStartDocument(QStringLiteral("1.0"), true);
	writer.writeStartElement(QStringLiteral("worksheet"));
	writer.writeAttribute(QStringLiteral("xmlns"), QStringLiteral("http://schemas.openxmlformats.org/spreadsheetml/2006/main"));
	writer.writeAttribute(QStringLiteral("xmlns:r"), QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships"));

	//for Excel 2010
	//    writer.writeAttribute("xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
	//    writer.writeAttribute("xmlns:x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
	//    writer.writeAttribute("mc:Ignorable", "x14ac");

	writer.writeStartElement(QStringLiteral("dimension"));
	writer.writeAttribute(QStringLiteral("ref"), d->generateDimensionString());
	writer.writeEndElement();//dimension

	writer.writeStartElement(QStringLiteral("sheetViews"));
	writer.writeStartElement(QStringLiteral("sheetView"));
	if (d->windowProtection)
		writer.writeAttribute(QStringLiteral("windowProtection"), QStringLiteral("1"));
	if (d->showFormulas)
		writer.writeAttribute(QStringLiteral("showFormulas"), QStringLiteral("1"));
	if (!d->showGridLines)
		writer.writeAttribute(QStringLiteral("showGridLines"), QStringLiteral("0"));
	if (!d->showRowColHeaders)
		writer.writeAttribute(QStringLiteral("showRowColHeaders"), QStringLiteral("0"));
	if (!d->showZeros)
		writer.writeAttribute(QStringLiteral("showZeros"), QStringLiteral("0"));
	if (d->rightToLeft)
		writer.writeAttribute(QStringLiteral("rightToLeft"), QStringLiteral("1"));
	if (d->tabSelected)
		writer.writeAttribute(QStringLiteral("tabSelected"), QStringLiteral("1"));
	if (!d->showRuler)
		writer.writeAttribute(QStringLiteral("showRuler"), QStringLiteral("0"));
	if (!d->showOutlineSymbols)
		writer.writeAttribute(QStringLiteral("showOutlineSymbols"), QStringLiteral("0"));
	if (!d->showWhiteSpace)
		writer.writeAttribute(QStringLiteral("showWhiteSpace"), QStringLiteral("0"));
	writer.writeAttribute(QStringLiteral("workbookViewId"), QStringLiteral("0"));
	writer.writeEndElement();//sheetView
	writer.writeEndElement();//sheetViews

	writer.writeStartElement(QStringLiteral("sheetFormatPr"));
	writer.writeAttribute(QStringLiteral("defaultRowHeight"), QString::number(d->default_row_height));
	if (d->default_row_height != 15)
		writer.writeAttribute(QStringLiteral("customHeight"), QStringLiteral("1"));
	if (d->default_row_zeroed)
		writer.writeAttribute(QStringLiteral("zeroHeight"), QStringLiteral("1"));
	if (d->outline_row_level)
		writer.writeAttribute(QStringLiteral("outlineLevelRow"), QString::number(d->outline_row_level));
	if (d->outline_col_level)
		writer.writeAttribute(QStringLiteral("outlineLevelCol"), QString::number(d->outline_col_level));
	//for Excel 2010
	//    writer.writeAttribute("x14ac:dyDescent", "0.25");
	writer.writeEndElement();//sheetFormatPr

    if (!d->colsInfo.isEmpty())
    {
		writer.writeStartElement(QStringLiteral("cols"));
		QMapIterator<int, QSharedPointer<XlsxColumnInfo> > it(d->colsInfo);
        while (it.hasNext())
        {
			it.next();
			QSharedPointer<XlsxColumnInfo> col_info = it.value();
			writer.writeStartElement(QStringLiteral("col"));
			writer.writeAttribute(QStringLiteral("min"), QString::number(col_info->firstColumn));
			writer.writeAttribute(QStringLiteral("max"), QString::number(col_info->lastColumn));
			if (col_info->width)
				writer.writeAttribute(QStringLiteral("width"), QString::number(col_info->width, 'g', 15));
			if (!col_info->format.isEmpty())
				writer.writeAttribute(QStringLiteral("style"), QString::number(col_info->format.xfIndex()));
			if (col_info->hidden)
				writer.writeAttribute(QStringLiteral("hidden"), QStringLiteral("1"));
			if (col_info->width)
				writer.writeAttribute(QStringLiteral("customWidth"), QStringLiteral("1"));
			if (col_info->outlineLevel)
				writer.writeAttribute(QStringLiteral("outlineLevel"), QString::number(col_info->outlineLevel));
			if (col_info->collapsed)
				writer.writeAttribute(QStringLiteral("collapsed"), QStringLiteral("1"));
			writer.writeEndElement();//col
		}
		writer.writeEndElement();//cols
	}

	writer.writeStartElement(QStringLiteral("sheetData"));
	if (d->dimension.isValid())
		d->saveXmlSheetData(writer);
	writer.writeEndElement();//sheetData

	d->saveXmlMergeCells(writer);
    for (const ConditionalFormatting &cf : d->conditionalFormattingList)
		cf.saveToXml(writer);
	d->saveXmlDataValidations(writer);

    //{{ liufeijin :  write  pagesettings  add by liufeijin 20181028

    // fixed by j2doll [dev18]
    // NOTE: empty element is not problem. but, empty structure of element is not parsed by Excel.

    // pageMargins
    if ( false == d->PMleft.isEmpty() &&
         false == d->PMright.isEmpty() &&
         false == d->PMtop.isEmpty() &&
         false == d->PMbotton.isEmpty() &&
         false == d->PMheader.isEmpty() &&
         false == d->PMfooter.isEmpty()
         )
    {
        writer.writeStartElement(QStringLiteral("pageMargins"));

        writer.writeAttribute(QStringLiteral("left"),   d->PMleft );
        writer.writeAttribute(QStringLiteral("right"),  d->PMright );
        writer.writeAttribute(QStringLiteral("top"),    d->PMtop );
        writer.writeAttribute(QStringLiteral("bottom"), d->PMbotton );
        writer.writeAttribute(QStringLiteral("header"), d->PMheader );
        writer.writeAttribute(QStringLiteral("footer"), d->PMfooter );

        writer.writeEndElement(); // pageMargins
    }

    // dev57
    if ( !d->Prid.isEmpty() )
    {
        writer.writeStartElement(QStringLiteral("pageSetup")); // pageSetup

        writer.writeAttribute(QStringLiteral("r:id"), d->Prid);

        if ( !d->PverticalDpi.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("verticalDpi"), d->PverticalDpi);
        }

        if ( !d->PhorizontalDpi.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("horizontalDpi"), d->PhorizontalDpi);
        }

        if ( !d->PuseFirstPageNumber.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("useFirstPageNumber"), d->PuseFirstPageNumber);
        }

        if ( !d->PfirstPageNumber.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("firstPageNumber"), d->PfirstPageNumber);
        }

        if ( !d->Pscale.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("scale"), d->Pscale);
        }

        if ( !d->PpaperSize.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("paperSize"), d->PpaperSize);
        }

        if ( !d->Porientation.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("orientation"), d->Porientation);
        }

        if(!d->Pcopies.isEmpty())
        {
            writer.writeAttribute(QStringLiteral("copies"), d->Pcopies);
        }

        writer.writeEndElement(); // pageSetup

    } // if ( !d->Prid.isEmpty() )

    // headerFooter
    if( !(d->ModdHeader.isNull()) ||
        !(d->MoodFooter.isNull()) )
    {
        writer.writeStartElement(QStringLiteral("headerFooter")); // headerFooter

        if ( !d->MoodalignWithMargins.isEmpty() )
        {
            writer.writeAttribute(QStringLiteral("alignWithMargins"), d->MoodalignWithMargins);
        }

        if ( !d->ModdHeader.isNull() )
        {
            writer.writeStartElement(QStringLiteral("oddHeader"));
            writer.writeCharacters(d->ModdHeader);
            writer.writeEndElement(); // oddHeader
        }

        if ( !d->MoodFooter.isNull() )
        {
            writer.writeTextElement(QStringLiteral("oddFooter"), d->MoodFooter);
        }

        writer.writeEndElement(); // headerFooter
    }

	d->saveXmlHyperlinks(writer);
	d->saveXmlDrawings(writer);

    writer.writeEndElement(); // worksheet
	writer.writeEndDocument();
}


void Mutex::ThreadSafeLazyInit() {
  // Dynamic mutexes are initialized in the constructor.
  if (type_ == kStatic) {
    switch (
        ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) {
      case 0:
        // If critical_section_init_phase_ was 0 before the exchange, we
        // are the first to test it and need to perform the initialization.
        owner_thread_id_ = 0;
        critical_section_ = new CRITICAL_SECTION;
        ::InitializeCriticalSection(critical_section_);
        // Updates the critical_section_init_phase_ to 2 to signal
        // initialization complete.
        GTEST_CHECK_(::InterlockedCompareExchange(
                          &critical_section_init_phase_, 2L, 1L) ==
                      1L);
        break;
      case 1:
        // Somebody else is already initializing the mutex; spin until they
        // are done.
        while (::InterlockedCompareExchange(&critical_section_init_phase_,
                                            2L,
                                            2L) != 2L) {
          // Possibly yields the rest of the thread's time slice to other
          // threads.
          ::Sleep(0);
        }
        break;

      case 2:
        break;  // The mutex is already initialized and ready for use.

      default:
        GTEST_CHECK_(false)
            << "Unexpected value of critical_section_init_phase_ "
            << "while initializing a static mutex.";
    }
  }
}

// Initializes owner_thread_id_ and critical_section_ in static mutexes.


bool ValidateRegex(const char* regex) {
  if (regex == NULL) {
    // TODO(wan@google.com): fix the source file location in the
    // assertion failures to match where the regex is used in user
    // code.
    ADD_FAILURE() << "NULL is not a valid simple regular expression.";
    return false;
  }

  bool is_valid = true;

  // True iff ?, *, or + can follow the previous atom.
  bool prev_repeatable = false;
  for (int i = 0; regex[i]; i++) {
    if (regex[i] == '\\') {  // An escape sequence
      i++;
      if (regex[i] == '\0') {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
                      << "'\\' cannot appear at the end.";
        return false;
      }

      if (!IsValidEscape(regex[i])) {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
                      << "invalid escape sequence \"\\" << regex[i] << "\".";
        is_valid = false;
      }
      prev_repeatable = true;
    } else {  // Not an escape sequence.
      const char ch = regex[i];

      if (ch == '^' && i > 0) {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
                      << "'^' can only appear at the beginning.";
        is_valid = false;
      } else if (ch == '$' && regex[i + 1] != '\0') {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
                      << "'$' can only appear at the end.";
        is_valid = false;
      } else if (IsInSet(ch, "()[]{}|")) {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
                      << "'" << ch << "' is unsupported.";
        is_valid = false;
      } else if (IsRepeat(ch) && !prev_repeatable) {
        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
                      << "'" << ch << "' can only follow a repeatable token.";
        is_valid = false;
      }

      prev_repeatable = !IsInSet(ch, "^$?*+");
    }
  }

  return is_valid;
}

// Generates non-fatal failures and returns false if regex is invalid;
// otherwise returns true.


GTEST_API_ Cardinality AtLeast(int n) { return Between(n, INT_MAX); }

// Creates a cardinality that allows at least n calls.


GTEST_API_ bool LogIsVisible(LogSeverity severity) {
  if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
    // Always show the log if --gmock_verbose=info.
    return true;
  } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {
    // Always hide it if --gmock_verbose=error.
    return false;
  } else {
    // If --gmock_verbose is neither "info" nor "error", we treat it
    // as "warning" (its default value).
    return severity == kWarning;
  }
}

// Returns true iff a log with the given severity is visible according
// to the --gmock_verbose flag.


TEST(Rotation, UnitQuaternionToAngleAxis) {
  double quaternion[4] = { 1, 0, 0, 0 };
  double axis_angle[3];
  double expected[3] = { 0, 0, 0 };
  QuaternionToAngleAxis(quaternion, axis_angle);
  EXPECT_THAT(axis_angle, IsNearAngleAxis(expected));
}

// Transforms a unit quaternion to an axis angle.


UncertainBackProjection::UncertainBackProjection(
    const sm::kinematics::UncertainVector3 & ray)
    : ray(ray) {
}

/// \brief the view origin is set to zero


RotationExpression RotationExpression::inverse()
    {
      boost::shared_ptr<RotationExpressionNode> newRoot( new RotationExpressionNodeInverse(_root) );
      return RotationExpression(newRoot);
    }

/// \brief return the expression that inverts the rotation.


Function function_namespace_env(){
    Environment ns = Environment::namespace_env( "stats" ) ;
    Function fun = ns[".asSparse"] ;  // accesses a non-exported function
    return fun;
}


NumericMatrix runit_SubMatrix( ){
    NumericMatrix xx(4, 5);
    xx(0,0) = 3;
    xx(0,1) = 4;
    xx(0,2) = 5;
    xx(1,_) = xx(0,_);
    xx(_,3) = xx(_,2);
    SubMatrix<REALSXP> yy = xx( Range(0,2), Range(0,3) ) ;
    NumericMatrix res = yy ;
    return res;
}


List list_erase( List list ){
    list.erase( list.begin() ) ;
    return list ;
}


String vec_print_character(CharacterVector v) {
    std::ostringstream buf;
    buf << v;
    return buf.str();
}


List runit_dt( NumericVector xx){
    return List::create(
        _["false"] = dt( xx, 5),
        _["true"]	 = dt( xx, 5, true ));
}


void formatXP(BOOL bUpgrade, WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText) {
    WCHAR pDashedKey[PK_LENGTH + 4 + NULL_TERMINATOR]{};
    INT   pSSection = 0;

    for (int i = 0; i < wcslen(pCSection); i++)
        pSSection -= pCSection[i] - '0';

    while (pSSection < 0)
        pSSection += 7;

    CHAR  pKey[PK_LENGTH + NULL_TERMINATOR]{};
    DWORD nChannelID = wcstoul(pBSection, nullptr, 10),
          nSequence = wcstoul(pCSection, nullptr, 10);

    BOOL  bValid = keyXP(pKey, pBINKPreset, nChannelID, nSequence, bUpgrade);

    QWORD pRaw[2]{},
          pSignature;

    DWORD pChannelID,
          pSequence,
          pSerial,
          pHash;

    BOOL  pUpgrade;

    unbase24((BYTE *)pRaw, pKey);
    unpackXP(pRaw, pUpgrade, pChannelID, pSequence, pHash, pSignature);

    pSerial = pChannelID * 1'000'000 + pSequence;

    for (int i = 0; i < 5; i++)
        wsprintfW(pDashedKey, L"%s%s%.5S", pDashedKey, i != 0 ? L"-" : L"", &pKey[5 * i]);

    swprintf(
        pText,
        L"PRODUCT ID:\tPPPPP-%03d-%06d%d-23XXX\r\n\r\nBYTECODE:\t%016llX %016llX\r\nUPGRADE:\t%s\r\nSERIAL:\t\t0x%lX (%d)\r\nHASH:\t\t0x%lX\r\nSIGNATURE:\t0x%llX\r\nCURVE POINT:\t%s\r\n\r\n\r\n%s\r\n",
        pChannelID,
        pSequence,
        pSSection,
        pRaw[1], pRaw[0],
        pUpgrade ? L"TRUE" : L"FALSE",
        pSerial, pSerial,
        pHash,
        pSignature,
        bValid ? L"TRUE" : L"FALSE",
        pDashedKey
    );
}


void CMpegAudEncPropertyPageAdv::SetDirty()
{
    m_bDirty = TRUE;
    if (m_pPageSite)
        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
}

//
// SetDirty
//
// notifies the property page site of changes


static bool isBusyFifoRead() {
  return !(SDHC_PRSSTAT & SDHC_PRSSTAT_BREN);
}


ark::bfloat16_t abs(ark::bfloat16_t const& h) { return ark::abs(h); }


void FastAccelStepperEngine::setDebugLed(uint8_t ledPin) {
  fas_ledPin = ledPin;
  pinMode(fas_ledPin, OUTPUT);
  digitalWrite(fas_ledPin, LOW);
}


ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
    impl->SetGlobalTestPartResultReporter(old_reporter_);
  } else {
    impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
  }
}

// The d'tor restores the test part result reporter used by Google Test
// before.


void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
  if (default_result_printer_ != listener) {
    // It is an error to pass this method a listener that is already in the
    // list.
    delete Release(default_result_printer_);
    default_result_printer_ = listener;
    if (listener != nullptr) Append(listener);
  }
}

// Sets the default_result_printer attribute to the provided listener.
// The listener is also added to the listener list and previous
// default_result_printer is removed from it and deleted. The listener can
// also be NULL in which case it will not be added to the list. Does
// nothing if the previous and the current listener objects are the same.


void CaptureStderr() {
  CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
}


TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {
  ASSERT_PRED_FORMAT4(PredFormatFunction4,
                      Bool(++n1_),
                      Bool(++n2_),
                      Bool(++n3_),
                      Bool(++n4_));
  finished_ = true;
}

// Tests a successful ASSERT_PRED_FORMAT4 where the
// predicate-formatter is a function on a user-defined type (Bool).


FailureOr<std::pair<unsigned, int64_t>> getNonUnitDimension(
    RankedTensorType tensorTy) {
  auto shape = tensorTy.getShape();

  if (llvm::count_if(shape, [](auto dim) { return dim != 1; }) != 1) {
    return failure();
  }

  unsigned nonUnitIndex = std::distance(
      shape.begin(), llvm::find_if(shape, [&](auto dim) { return dim != 1; }));

  return std::make_pair(nonUnitIndex, shape[nonUnitIndex]);
}

// Returns the unique non-unit dimension of a tensor and its rank.
// Returns failure if the tensor has more than one non-unit dimension.


BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess,
                                       _In_reads_(nDlls) LPCSTR *rlpDlls,
                                       _In_ DWORD nDlls)
{
    // Find the next memory region that contains a mapped PE image.
    //
    BOOL bHas64BitDll = FALSE;
    BOOL bHas32BitExe = FALSE;
    BOOL bIs32BitProcess;
    HMODULE hModule = NULL;
    HMODULE hLast = NULL;

    DETOUR_TRACE(("DetourUpdateProcessWithDll(%p,dlls=%d)\n", hProcess, nDlls));

    for (;;) {
        IMAGE_NT_HEADERS32 inh;

        if ((hLast = EnumerateModulesInProcess(hProcess, hLast, &inh)) == NULL) {
            break;
        }

        DETOUR_TRACE(("%p  machine=%04x magic=%04x\n",
                      hLast, inh.FileHeader.Machine, inh.OptionalHeader.Magic));

        if ((inh.FileHeader.Characteristics & IMAGE_FILE_DLL) == 0) {
            hModule = hLast;
            if (inh.OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC
                && inh.FileHeader.Machine != 0) {

                bHas32BitExe = TRUE;
            }
            DETOUR_TRACE(("%p  Found EXE\n", hLast));
        }
        else {
            if (inh.OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC
                && inh.FileHeader.Machine != 0) {

                bHas64BitDll = TRUE;
            }
        }
    }

    if (hModule == NULL) {
        SetLastError(ERROR_INVALID_OPERATION);
        return FALSE;
    }

    if (!bHas32BitExe) {
        bIs32BitProcess = FALSE;
    }
    else if (!bHas64BitDll) {
        bIs32BitProcess = TRUE;
    }
    else {
        if (!IsWow64Process(hProcess, &bIs32BitProcess)) {
            return FALSE;
        }
    }

    DETOUR_TRACE(("    32BitExe=%d 32BitProcess\n", bHas32BitExe, bIs32BitProcess));

    return DetourUpdateProcessWithDllEx(hProcess,
                                        hModule,
                                        bIs32BitProcess,
                                        rlpDlls,
                                        nDlls);
}


static std::filesystem::path get_appdata_dir()
{
	PWSTR pwstr_appdata_directory;
	HRESULT result = SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, NULL, &pwstr_appdata_directory);
	assert(SUCCEEDED(result));
	std::filesystem::path ret = pwstr_appdata_directory;
	CoTaskMemFree(pwstr_appdata_directory);
	return ret / "oxware";
}

// just a little hack over the fact that this code already exists inside the FileSystem code.. since we
// want to have the console ready right as soon as the application starts, we cannot just use the appdata manager
// or the filesystem, so yeah.. this kinda sucks but whatever, its worth it so that we can log as soon as we start..


public ListNode getMid(ListNode head) {
        ListNode slow = head, fast = head.next;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
        }
        return slow;
    }

/**
     * Find middle with usage slow and fast pointers
     */


@GetMapping(value = "/index")
    public String index(HttpServletRequest httpRequest, HttpSession session, Model model) {
        return "system/index";
    }

/**
     * 跳转到浪海博客后台管理首页
     *
     * @return 后台管理首页页面 system/index.html
     */


public ArrayList<Setting> getSettingList() {
        return settingList;
    }

/**
     * @return Returns an Arraylist of all settings
     */


public void writeBytes(byte []buffer, int offset, int length)
    throws IOException
  {
    if (buffer == null) {
      print("<null></null>");
    }
    else {
      print("<base64>");

      int i = 0;
      for (; i + 2 < length; i += 3) {
        if (i != 0 && (i & 0x3f) == 0)
          print('\n');

        int v = (((buffer[offset + i] & 0xff) << 16) +
                 ((buffer[offset + i + 1] & 0xff) << 8) +
                 (buffer[offset + i + 2] & 0xff));

        print(encode(v >> 18));
        print(encode(v >> 12));
        print(encode(v >> 6));
        print(encode(v));
      }

      if (i + 1 < length) {
        int v = (((buffer[offset + i] & 0xff) << 8) +
                 (buffer[offset + i + 1] & 0xff));

        print(encode(v >> 10));
        print(encode(v >> 4));
        print(encode(v << 2));
        print('=');
      }
      else if (i < length) {
        int v = buffer[offset + i] & 0xff;

        print(encode(v >> 2));
        print(encode(v << 4));
        print('=');
        print('=');
      }

      print("</base64>");
    }
  }

/**
   * Writes a byte array to the stream.
   * The array will be written with the following syntax:
   *
   *

   * <base64>bytes</base64>
   *

   *
   * If the value is null, it will be written as
   *
   *

   * <null></null>
   *

   *
   * @param value the string value to write.
   */


public void reset()
  {
    if (_refs != null) {
      _refs.clear();
      _refCount = 0;
    }

    _classRefs.clear();
    _typeRefs = null;
    _offset = 0;
    _isPacket = false;
    _isUnshared = false;
  }

/**
   * Resets all counters and references
   */


public void writeInt(int value)
    throws IOException
  {
    os.write('I');
    os.write(value >> 24);
    os.write(value >> 16);
    os.write(value >> 8);
    os.write(value);
  }

/**
   * Writes an integer value to the stream.  The integer will be written
   * with the following syntax:
   *
   *

   * I b32 b24 b16 b8
   *

   *
   * @param value the integer value to write.
   */


public byte getAlgorithm() {
        return algorithm;
    }

/**
     * Get Algorithm tag.
     *
     * @return algorithm - The algorithm tag of crypto operation.
     */


public Builder clearLiveId() {
      bitField0_ = (bitField0_ & ~0x00000080);
      liveId_ = 0L;
      onChanged();
      return this;
    }

/**
     * int64 live_id = 14;
     * @return This builder for chaining.
     */


public cool.scx.live_room_watcher.impl.douyin_hack.proto_entity.webcast.data.GiftStructOrBuilder getGiftOrBuilder() {
      if (giftBuilder_ != null) {
        return giftBuilder_.getMessageOrBuilder();
      } else {
        return gift_ == null ?
            cool.scx.live_room_watcher.impl.douyin_hack.proto_entity.webcast.data.GiftStruct.getDefaultInstance() : gift_;
      }
    }

/**
     * <code>.GiftStruct gift = 15;</code>
     */


public Builder addAllMessages(
        java.lang.Iterable<? extends cool.scx.live_room_watcher.impl.douyin_hack.proto_entity.webcast.im.Message> values) {
      if (messagesBuilder_ == null) {
        ensureMessagesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, messages_);
        onChanged();
      } else {
        messagesBuilder_.addAllMessages(values);
      }
      return this;
    }

/**
     * repeated .Message messages = 1;
     */


@java.lang.Override
    public boolean hasUser() {
      return ((bitField0_ & 0x00000001) != 0);
    }

/**
     * <code>.User user = 1;</code>
     * @return Whether the user field is set.
     */


public com.google.protobuf.ByteString
          getScoreStrBytes() {
        java.lang.Object ref = scoreStr_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          scoreStr_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

/**
       * string score_str = 2;
       * @return The bytes for scoreStr.
       */


@java.lang.Override
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      name_ = s;
      return s;
    }
  }

/**
   * string name = 16;
   * @return The name.
   */


@java.lang.Override
  public cool.scx.live_room_watcher.impl.tiktok_hack.proto_entity.webcast.im.ChatMessage.EmoteWithIndex getEmotesList(int index) {
    return emotesList_.get(index);
  }

/**
   * repeated .tiktok_hack.ChatMessage.EmoteWithIndex emotesList = 13;
   */


@java.lang.Override
  public cool.scx.live_room_watcher.impl.tiktok_hack.proto_entity.webcast.data.LiveMessageID getDependId() {
    return dependId_ == null ? cool.scx.live_room_watcher.impl.tiktok_hack.proto_entity.webcast.data.LiveMessageID.getDefaultInstance() : dependId_;
  }

/**
   * <code>.tiktok_hack.LiveMessageID dependId = 20;</code>
   * @return The dependId.
   */


public Builder setRoomMessageHeatLevel(
        java.lang.String value) {
      if (value == null) { throw new NullPointerException(); }
      roomMessageHeatLevel_ = value;
      bitField0_ |= 0x00200000;
      onChanged();
      return this;
    }

/**
     * string roomMessageHeatLevel = 22;
     * @param value The roomMessageHeatLevel to set.
     * @return This builder for chaining.
     */


@java.lang.Override
  public java.lang.String getEffectCnt() {
    java.lang.Object ref = effectCnt_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      effectCnt_ = s;
      return s;
    }
  }

/**
   * string effectCnt = 9;
   * @return The effectCnt.
   */


@java.lang.Override
  public cool.scx.live_room_watcher.impl.tiktok_hack.proto_entity.webcast.im.PublicAreaMessageCommonOrBuilder getPublicAreaMessageCommonOrBuilder() {
    return publicAreaMessageCommon_ == null ? cool.scx.live_room_watcher.impl.tiktok_hack.proto_entity.webcast.im.PublicAreaMessageCommon.getDefaultInstance() : publicAreaMessageCommon_;
  }

/**
   * <code>.tiktok_hack.PublicAreaMessageCommon publicAreaMessageCommon = 11;</code>
   */


public com.google.protobuf.ByteString
        getIsFirstBytes() {
      java.lang.Object ref = isFirst_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        isFirst_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

/**
     * string isFirst = 11;
     * @return The bytes for isFirst.
     */


@PreAuthorize("@ss.hasPermi('system:role:query')")
    @GetMapping(value = "/{roleId}")
    public AjaxResult getInfo(@PathVariable Long roleId)
    {
        roleService.checkRoleDataScope(roleId);
        return AjaxResult.success(roleService.selectRoleById(roleId));
    }

/**
     * 根据角色编号获取详细信息
     */


@Override
    public void validateEdit(GenTable genTable) {
        if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
            String options = JSON.toJSONString(genTable.getParams());
            JSONObject paramsObj = JSONObject.parseObject(options);
            if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
                throw new ServiceException("树编码字段不能为空");
            } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
                throw new ServiceException("树父编码字段不能为空");
            } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
                throw new ServiceException("树名称字段不能为空");
            } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
                if (StringUtils.isEmpty(genTable.getSubTableName())) {
                    throw new ServiceException("关联子表的表名不能为空");
                } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
                    throw new ServiceException("子表关联的外键名不能为空");
                }
            }
        }
    }

/**
     * 修改保存参数校验
     *
     * @param genTable 业务信息
     */


private static CelFunctionDecl sanitizeFunction(CelFunctionDecl func) {
    boolean needsSanitizing = false;
    for (CelOverloadDecl o : func.overloads()) {
      if (isWellKnownType(o.resultType())) {
        needsSanitizing = true;
        break;
      }
      for (CelType p : o.parameterTypes()) {
        if (isWellKnownType(p)) {
          needsSanitizing = true;
          break;
        }
      }
    }
    if (!needsSanitizing) {
      return func;
    }

    CelFunctionDecl.Builder funcBuilder = func.toBuilder();
    ImmutableSet.Builder<CelOverloadDecl> overloadsBuilder = new ImmutableSet.Builder<>();
    for (CelOverloadDecl overloadDecl : funcBuilder.overloads()) {
      CelOverloadDecl.Builder overloadBuilder = overloadDecl.toBuilder();
      CelType resultType = overloadBuilder.build().resultType();
      if (isWellKnownType(resultType)) {
        overloadBuilder.setResultType(getWellKnownType(resultType));
      }

      ImmutableList.Builder<CelType> parameterTypeBuilder = ImmutableList.builder();
      for (CelType paramType : overloadBuilder.parameterTypes()) {
        if (isWellKnownType(paramType)) {
          parameterTypeBuilder.add(getWellKnownType(paramType));
        } else {
          parameterTypeBuilder.add(paramType);
        }
      }
      overloadBuilder.setParameterTypes(parameterTypeBuilder.build());
      overloadsBuilder.add(overloadBuilder.build());
    }
    return funcBuilder.setOverloads(overloadsBuilder.build()).build();
  }

/**
   * Sanitize the function declaration type making sure that proto-based message names appearing in
   * the result or parameter types are mapped to the appropriate CEL types.
   */


@SuppressWarnings("DoNotCallSuggester")
  Object eval(CelAbstractSyntaxTree ast, Map<String, ?> parameterValues) {
    throw new UnsupportedOperationException("To be implemented");
  }

/**
   * Evaluates the compiled AST with the user provided parameter values.
   *
   * @throws IllegalArgumentException If the compiled expression in AST fails to evaluate.
   */


private static Optional<Integer> getLocationOffsetImpl(
      List<Integer> lineOffsets, int line, int column) {
    if (line <= 0 || column < 0) {
      return Optional.empty();
    }
    int offset = CelSourceHelper.findLineOffset(lineOffsets, line);
    if (offset == -1) {
      return Optional.empty();
    }
    return Optional.of(offset + column);
  }

/**
   * Get the code point offset within the source expression text that corresponds with the {@code
   * line} and {@code column}.
   *
   * @param line the line number starting from 1
   * @param column the column number starting from 0
   */


public ImmutableList<CelMap.Entry> getEntries() {
        return ImmutableList.copyOf(mutableEntries);
      }

/** Returns an immutable copy of the current mutable entries present in the builder. */


public final CelExpr fold(
      String iterVar,
      CelExpr.Builder iterRange,
      String accuVar,
      CelExpr accuInit,
      CelExpr.Builder condition,
      CelExpr step,
      CelExpr result) {
    return fold(iterVar, iterRange.build(), accuVar, accuInit, condition.build(), step, result);
  }

/** Fold creates a fold comprehension instruction. */


@GetMapping("/frame1")
    public String frame1()
    {
        return prefix + "/table/frame1";
    }


public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }

/**
     * 获取上传路径
     */


public static String getIpAddr(HttpServletRequest request)
    {
        if (request == null)
        {
            return "unknown";
        }
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("X-Forwarded-For");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("X-Real-IP");
        }

        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getRemoteAddr();
        }

        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
    }

/**
     * 获取客户端IP
     *
     * @param request 请求对象
     * @return IP地址
     */


public static int ZZ_CMAP(int ch) {
    return ZZ_CMAP_A[ZZ_CMAP_Y[ZZ_CMAP_Z[ch>>13]|((ch>>7)&0x3f)]|(ch&0x7f)];
  }

/**
   * Translates characters to character classes
   * Chosen bits are [8, 6, 7]
   * Total runtime size is 1040 bytes
   */


public static void populateKeyLookupTables() {
        for (int key = 0; key <= 255; key++) {
            getKeyName(key);
        }
    }

/** Populates the key name->index lookup table with the current keyboard layout based names. */


public static WaveData create(ByteBuffer buffer) {
        try {
            byte[] bytes = null;

            if (buffer.hasArray()) {
                bytes = buffer.array();
            } else {
                bytes = new byte[buffer.capacity()];
                buffer.get(bytes);
            }
            return create(bytes);
        } catch (Exception e) {
            org.lwjglx.LWJGLUtil.log("Unable to create from ByteBuffer, " + e.getMessage());
            return null;
        }
    }

/**
     * Creates a WaveData container from the specified ByetBuffer. If the buffer is backed by an array, it will be used
     * directly, else the contents of the buffer will be copied using get(byte[]).
     *
     * @param buffer ByteBuffer containing sound file
     * @return WaveData containing data, or null if a failure occured
     */


public Matrix invert() {
        return invert(this, this);
    }

/**
     * Invert this matrix
     *
     * @return this if successful, null otherwise
     */


public void viewImage(@NonNull Uri imageUri) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.setDataAndType(imageUri, "image/*");
        intent.setFlags(FLAG_GRANT_READ_URI_PERMISSION);
        try {
            getContext().startActivity(intent);
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    }

/**
     * Instantiates view intent to view an image in default image viewer
     *
     * @param imageUri The image {@link URI}, which is to be viewed
     */


@SuppressWarnings("unchecked")
    @Override
    protected Map<Object, Object> getSourcesFromContainer(Container<?> container, Collection<Target> targets) {
        Set<Object> keys = targets.stream()
            .map(Target::getKey)
            .map(k -> (Collection<?>)k)
            .flatMap(Collection::stream)
            .collect(Collectors.toSet());
        return (Map<Object, Object>)((Container<Object>)container).get(keys);
    }

/**
     * Obtain the corresponding data source object from the data source container based on the entity's key value.
     *
     * @param container container
     * @param targets   targets
     * @return source objects
     */


public Set<Class<?>> scan(String... basePackages) {
        return scan(Objects::nonNull, basePackages);
    }

/**
     * <p>Scan all classes under the specified package.
     *
     * @param basePackages the specified package
     * @return a set of classes
     */


public SwerveModuleState getState()
  {
    double     velocity;
    Rotation2d azimuth;
    if (!SwerveDriveTelemetry.isSimulation)
    {
      velocity = driveVelocityCache.getValue();
      azimuth = Rotation2d.fromDegrees(getAbsolutePosition());
    } else
    {
      return simModule.getState();
    }
    return new SwerveModuleState(velocity, azimuth);
  }

/**
   * Get the Swerve Module state.
   *
   * @return Current SwerveModule state.
   */


@Override
  public Object getAbsoluteEncoder()
  {
    return encoder;
  }

/**
   * Get the instantiated absolute encoder Object.
   *
   * @return Absolute encoder object.
   */


@Override
  public void factoryDefault()
  {
    imu.resetFactoryDefaults(STATUS_TIMEOUT_SECONDS);
  }

/**
   * Reset {@link Canandgyro} to factory default.
   */


@Test
    public void chatCompletionTokensTest() {
        ChatCompletion completion = ChatCompletion.builder().messages(messages).build();
        long tokens = completion.tokens();
        log.info("Message集合文本：【{}】", messages, tokens);
        log.info("总tokens数{}", tokens);
    }

/**
     * gpt-3.5和gpt4.0聊天模型接口计算推荐这种方法
     */


@Blocking
    @Nullable
    @Override
    public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
        checkMinimalStage();
        return cf.get(timeout, unit);
    }

/**
     * Waits if necessary for at most the given time for the computation to complete,
     * and then retrieves its result, if available.
     *
     * @param timeout the maximum time to wait
     * @param unit    the time unit of the timeout argument
     * @return the computed result
     * @throws CancellationException if the computation was cancelled
     * @throws ExecutionException    if the computation threw an exception
     * @throws InterruptedException  if the current thread was interrupted while waiting
     * @throws TimeoutException      if the wait timed out
     */


@Override
	public boolean isSameThan(__ptr__ other) {
		ST_subtree_t other2 = (ST_subtree_t) other;
		return this == other2;
	}


public DiagramType getDiagramType() {
		return DiagramType.getTypeFromArobaseStart(source.get(0).getString());
	}

/**
	 * Retrieve the type of the diagram. This is based on the first line
	 * <code>@startfoo</code>.
	 *
	 * @return the type of the diagram.
	 */


public JsonObject set(String name, double value) {
		set(name, Json.value(value));
		return this;
	}

/**
	 * Sets the value of the member with the specified name to the JSON
	 * representation of the specified double value. If this object
	 * does not contain a member with this name, a new member is added at the end of
	 * the object. If this object contains multiple members with this name, only the
	 * last one is changed.
	 *

	 * This method should only be used to modify existing objects.
	 * To fill a new object with members, the method add(name, value)
	 * should be preferred which is much faster (as it does not need to search for
	 * existing members).
	 *

	 *
	 * @param name  the name of the member to add
	 * @param value the value of the member to add
	 * @return the object itself, to enable method chaining
	 */


public boolean isShowProgressBar() {
    return mShowProgressBar;
  }

/**
   * if to show progress bar when image async loading/cropping is in progress.<br>
   * default: true, disable to provide custom progress bar UI.
   */


protected Stream<String> getLines(Path file) throws IOException {
        return Files.lines(file);
    }


public String getName() { return name; }

/**
     * @return The unique name of this capability, typically this is
     * the fully qualified class name for the target interface.
     */


public boolean isBooleanValue()
    {
        return ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase()));
    }

/**
     * Checks if the current value held by this property is a valid boolean value.
     *
     * @return True if it is a boolean value
     */


@SideOnly(Side.CLIENT)
    public static IAnimationStateMachine load(IResourceManager manager, ResourceLocation location, ImmutableMap<String, ITimeValue> customParameters)
    {
        try (IResource resource = manager.getResource(location))
        {
            ClipResolver clipResolver = new ClipResolver();
            ParameterResolver parameterResolver = new ParameterResolver(customParameters);
            Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver);
            TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver);
            AnimationStateMachine asm = asmGson.fromJson(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), AnimationStateMachine.class);
            clipResolver.asm = asm;
            parameterResolver.asm = asm;
            asm.initialize();
            //String json = asmGson.toJson(asm);
            //System.out.println(location + ": " + json);
            return asm;
        }
        catch(IOException | JsonParseException e)
        {
            FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
            return missing;
        }
        finally
        {
            Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null);
            TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null);
        }
    }

/**
     * Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.
     */


@Deprecated
    public static int getFuelValue(@Nonnull ItemStack itemStack)
    {
        return ForgeEventFactory.getItemBurnTime(itemStack);
    }

/**
     * @deprecated use {@link ForgeEventFactory#getItemBurnTime(ItemStack)}
     */


private static int get2Fold(int fold) {
        int ret = 2;
        while (ret < fold) {
            ret *= 2;
        }
        return ret;
    }

/**
     * Get the closest greater power of 2 to the fold number
     *
     * @param fold The target number
     * @return The power of 2
     */


public Matrix transpose() {
        return transpose(this);
    }

/**
     * Transpose this matrix
     *
     * @return this
     */


public final float getY() {
        return y;
    }


@Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30)
                // 是否启用Swagger
                .enable(enabled)
                // 用来创建该API的基本信息，展示在文档的页面中（自定义展示的信息）
                .apiInfo(apiInfo())
                // 设置哪些接口暴露给Swagger展示
                .select()
                // 扫描所有有注解的api，用这种方式更灵活
                .apis(RequestHandlerSelectors.withMethodAnnotation(Operation.class))
                // 扫描指定包中的swagger注解
                // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
                // 扫描所有 .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                /* 设置安全模式，swagger可以设置访问token */
                .securitySchemes(securitySchemes())
                .securityContexts(securityContexts());
    }


public static Double toDouble(Object value) {
        return toDouble(value, null);
    }

/**
     * 转换为double

     * 如果给定的值为空，或者转换失败，返回默认值null

     * 转换失败不会报错
     *
     * @param value 被转换的值
     * @return 结果
     */


public static boolean ishttp(String link) {
        return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
    }

/**
     * 是否为http(s)://开头
     *
     * @param link 链接
     * @return 结果
     */


@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        /** 本地文件上传路径 */
        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
                .addResourceLocations("file:" + ConfigExpander.getFileProfile() + "/");

        /** swagger配置 */
        registry.addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
    }

/**
     * 映射到访问本地的资源文件
     *
     * @param registry
     */


public boolean execRequest(Request request, String code) throws Exception {
        if (StringUtils.isEmpty(code)) {
            return true;
        }
        InMemoryJavaCompiler memoryJavaCompiler = javac(prependPublicToCoolRequestScript(REQUEST_REGEX, code), REQUEST_CLASS);
        Class<?> requestClass = memoryJavaCompiler.getClassloader().loadClass(REQUEST_CLASS);
        return invokeRequest(requestClass, request);
    }

/**
     * 执行前置脚本
     *
     * @return 如果返回false，则表示被脚本拒绝执行
     */


public void set$vocabulary(String $vocabulary) {
        this.$vocabulary = $vocabulary;
    }


public XML getXml() {
        return xml;
    }

/**
     * returns the xml property from a Schema instance.
     *
     * @return XML xml
     **/


public static void isNull( Object object, String message) {
        if (object != null) {
            throw new IllegalArgumentException(message);
        }
    }

/**
     * Assert that an object is {@code null}.
     *
Assert.isNull(value, "The value must be null");

     * @param object the object to check
     * @param message the exception message to use if the assertion fails
     * @throws IllegalArgumentException if the object is not {@code null}
     */


@java.lang.Override
    public int getUnk3300BALCPHMFIBC() {
      return unk3300BALCPHMFIBC_;
    }

/**
     * uint32 Unk3300_BALCPHMFIBC = 1940;
     * @return The unk3300BALCPHMFIBC.
     */


@java.lang.Override
    public int getTargetType() {
      return targetType_;
    }

/**
     * uint32 targetType = 346;
     * @return The targetType.
     */


@java.lang.Override
    public emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString getKey() {
      return key_ == null ? emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString.getDefaultInstance() : key_;
    }

/**
     * <code>.AbilityString key = 7;</code>
     * @return The key.
     */


public emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString getKey() {
        if (keyBuilder_ == null) {
          return key_ == null ? emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString.getDefaultInstance() : key_;
        } else {
          return keyBuilder_.getMessage();
        }
      }

/**
       * <code>.AbilityString key = 7;</code>
       * @return The key.
       */


public Builder setPosition(
          emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) {
        if (positionBuilder_ == null) {
          position_ = builderForValue.build();
          onChanged();
        } else {
          positionBuilder_.setMessage(builderForValue.build());
        }

        return this;
      }

/**
       * <code>.Vector position = 1;</code>
       */


public Builder clearFaceDir() {
        if (faceDirBuilder_ == null) {
          faceDir_ = null;
          onChanged();
        } else {
          faceDir_ = null;
          faceDirBuilder_ = null;
        }

        return this;
      }

/**
       * <code>.Vector face_dir = 5;</code>
       */


public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getRegionCenterPosOrBuilder() {
        if (regionCenterPosBuilder_ != null) {
          return regionCenterPosBuilder_.getMessageOrBuilder();
        } else {
          return regionCenterPos_ == null ?
              emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : regionCenterPos_;
        }
      }

/**
       * <code>.Vector regionCenterPos = 13;</code>
       */


@java.lang.Override
    public int getWishProgress() {
      return wishProgress_;
    }

/**
     * uint32 wishProgress = 12;
     * @return The wishProgress.
     */


@java.lang.Override
    public boolean hasIntVal() {
      return mMJOJNNFGCNCase_ == 2;
    }

/**
     * int32 int_val = 2;
     * @return Whether the intVal field is set.
     */


public emu.grasscutter.net.proto.ExhibitionDisplayInfoOuterClass.ExhibitionDisplayInfo getCardList(int index) {
        if (cardListBuilder_ == null) {
          return cardList_.get(index);
        } else {
          return cardListBuilder_.getMessage(index);
        }
      }

/**
       * repeated .ExhibitionDisplayInfo cardList = 2;
       */


@java.lang.Override
    public int getNextAddTimestamp() {
      return nextAddTimestamp_;
    }

/**
     * uint32 nextAddTimestamp = 4;
     * @return The nextAddTimestamp.
     */


public emu.grasscutter.net.proto.WeaponOuterClass.Weapon.Builder getWeaponBuilder() {
        return getWeaponFieldBuilder().getBuilder();
      }

/**
       * <code>.Weapon weapon = 3;</code>
       */


public emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo getWeaponAbilityInfo() {
        if (weaponAbilityInfoBuilder_ == null) {
          return weaponAbilityInfo_ == null ? emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo.getDefaultInstance() : weaponAbilityInfo_;
        } else {
          return weaponAbilityInfoBuilder_.getMessage();
        }
      }

/**
       * <code>.AbilitySyncStateInfo weaponAbilityInfo = 6;</code>
       * @return The weaponAbilityInfo.
       */


public Builder clearMaterialId() {

        materialId_ = 0;
        onChanged();
        return this;
      }

/**
       * uint32 materialId = 10;
       * @return This builder for chaining.
       */


@java.lang.Override
    public java.util.List<java.lang.Integer>
        getRuneListList() {
      return runeList_;
    }

/**
     * repeated uint32 rune_list = 3;
     * @return A list containing the runeList.
     */


public Builder setContentCloseTime(int value) {

        contentCloseTime_ = value;
        onChanged();
        return this;
      }

/**
       * uint32 content_close_time = 11;
       * @param value The contentCloseTime to set.
       * @return This builder for chaining.
       */


public emu.grasscutter.net.proto.TreasureSeelieRegionDataOuterClass.TreasureSeelieRegionData.Builder getRegionDataListBuilder(
          int index) {
        return getRegionDataListFieldBuilder().getBuilder(index);
      }

/**
       * repeated .TreasureSeelieRegionData region_data_list = 6;
       */


public emu.grasscutter.net.proto.BounceConjuringChapterInfoOuterClass.BounceConjuringChapterInfo.Builder addChapterInfoListBuilder(
          int index) {
        return getChapterInfoListFieldBuilder().addBuilder(
            index, emu.grasscutter.net.proto.BounceConjuringChapterInfoOuterClass.BounceConjuringChapterInfo.getDefaultInstance());
      }

/**
       * repeated .BounceConjuringChapterInfo chapter_info_list = 15;
       */


public Builder addStageInfoList(
          int index, emu.grasscutter.net.proto.OMNAAMAIBOHOuterClass.OMNAAMAIBOH.Builder builderForValue) {
        if (stageInfoListBuilder_ == null) {
          ensureStageInfoListIsMutable();
          stageInfoList_.add(index, builderForValue.build());
          onChanged();
        } else {
          stageInfoListBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }

/**
       * repeated .OMNAAMAIBOH stageInfoList = 12;
       */


@java.lang.Override
    public int getProgress() {
      return progress_;
    }

/**
     * uint32 progress = 3;
     * @return The progress.
     */


public Builder setTeamList(
          int index, emu.grasscutter.net.proto.SumoTeamDataOuterClass.SumoTeamData value) {
        if (teamListBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureTeamListIsMutable();
          teamList_.set(index, value);
          onChanged();
        } else {
          teamListBuilder_.setMessage(index, value);
        }
        return this;
      }

/**
       * repeated .SumoTeamData team_list = 1;
       */


public Builder setRaceInfoList(
          int index, emu.grasscutter.net.proto.WinterCampRaceStageInfoOuterClass.WinterCampRaceStageInfo.Builder builderForValue) {
        if (raceInfoListBuilder_ == null) {
          ensureRaceInfoListIsMutable();
          raceInfoList_.set(index, builderForValue.build());
          onChanged();
        } else {
          raceInfoListBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }

/**
       * repeated .WinterCampRaceStageInfo raceInfoList = 5;
       */


public emu.grasscutter.net.proto.WinterCampStageInfoOuterClass.WinterCampStageInfo getExploreInfo() {
        if (exploreInfoBuilder_ == null) {
          return exploreInfo_ == null ? emu.grasscutter.net.proto.WinterCampStageInfoOuterClass.WinterCampStageInfo.getDefaultInstance() : exploreInfo_;
        } else {
          return exploreInfoBuilder_.getMessage();
        }
      }

/**
       * <code>.WinterCampStageInfo exploreInfo = 1;</code>
       * @return The exploreInfo.
       */


@java.lang.Override
    public int getUnk3300KFDGFFPJGJC() {
      return unk3300KFDGFFPJGJC_;
    }

/**
     * uint32 Unk3300_KFDGFFPJGJC = 4;
     * @return The unk3300KFDGFFPJGJC.
     */


public Builder setUnk3300KIOMJNHFMDE(boolean value) {

        unk3300KIOMJNHFMDE_ = value;
        onChanged();
        return this;
      }

/**
       * bool Unk3300_KIOMJNHFMDE = 11;
       * @param value The unk3300KIOMJNHFMDE to set.
       * @return This builder for chaining.
       */


public Builder setIsHasChange(boolean value) {

        isHasChange_ = value;
        onChanged();
        return this;
      }

/**
       * bool isHasChange = 3;
       * @param value The isHasChange to set.
       * @return This builder for chaining.
       */


@java.lang.Override
      public emu.grasscutter.net.proto.BonusInfoOuterClass.BonusInfoOrBuilder getBonusInfoOrBuilder() {
        if ((detailCase_ == 11) && (bonusInfoBuilder_ != null)) {
          return bonusInfoBuilder_.getMessageOrBuilder();
        } else {
          if (detailCase_ == 11) {
            return (emu.grasscutter.net.proto.BonusInfoOuterClass.BonusInfo) detail_;
          }
          return emu.grasscutter.net.proto.BonusInfoOuterClass.BonusInfo.getDefaultInstance();
        }
      }

/**
       * <code>.BonusInfo bonus_info = 11;</code>
       */


public Builder setDayIndex(int value) {

        dayIndex_ = value;
        onChanged();
        return this;
      }

/**
       * uint32 dayIndex = 8;
       * @param value The dayIndex to set.
       * @return This builder for chaining.
       */


public emu.grasscutter.net.proto.WinterCampRecvItemDataOuterClass.WinterCampRecvItemData getRecvItemData() {
        if (recvItemDataBuilder_ == null) {
          return recvItemData_ == null ? emu.grasscutter.net.proto.WinterCampRecvItemDataOuterClass.WinterCampRecvItemData.getDefaultInstance() : recvItemData_;
        } else {
          return recvItemDataBuilder_.getMessage();
        }
      }

/**
       * <code>.WinterCampRecvItemData recvItemData = 5;</code>
       * @return The recvItemData.
       */


public Builder setIsTruncated(boolean value) {

        isTruncated_ = value;
        onChanged();
        return this;
      }

/**
       * bool isTruncated = 8;
       * @param value The isTruncated to set.
       * @return This builder for chaining.
       */


public emu.grasscutter.net.proto.HomeFurnitureDataOuterClass.HomeFurnitureData.Builder addDeployFurniureListBuilder(
          int index) {
        return getDeployFurniureListFieldBuilder().addBuilder(
            index, emu.grasscutter.net.proto.HomeFurnitureDataOuterClass.HomeFurnitureData.getDefaultInstance());
      }

/**
       * repeated .HomeFurnitureData deployFurniureList = 15;
       */


@java.lang.Override
    public int getUid() {
      return uid_;
    }

/**
     * uint32 uid = 10;
     * @return The uid.
     */


public Builder clearIsOpen() {

        isOpen_ = false;
        onChanged();
        return this;
      }

/**
       * bool isOpen = 2;
       * @return This builder for chaining.
       */


@java.lang.Override
    public emu.grasscutter.net.proto.LuminanceStoneChallengeInfoOuterClass.LuminanceStoneChallengeInfoOrBuilder getLuminanceStoneChallengeInfoOrBuilder() {
      if (iKJIPGGMNBKCase_ == 142) {
         return (emu.grasscutter.net.proto.LuminanceStoneChallengeInfoOuterClass.LuminanceStoneChallengeInfo) iKJIPGGMNBK_;
      }
      return emu.grasscutter.net.proto.LuminanceStoneChallengeInfoOuterClass.LuminanceStoneChallengeInfo.getDefaultInstance();
    }

/**
     * <code>.LuminanceStoneChallengeInfo luminance_stone_challenge_info = 142;</code>
     */


public Builder mergeIrodoriInfo(emu.grasscutter.net.proto.IrodoriInfoOuterClass.IrodoriInfo value) {
        if (irodoriInfoBuilder_ == null) {
          if (iKJIPGGMNBKCase_ == 1014 &&
              iKJIPGGMNBK_ != emu.grasscutter.net.proto.IrodoriInfoOuterClass.IrodoriInfo.getDefaultInstance()) {
            iKJIPGGMNBK_ = emu.grasscutter.net.proto.IrodoriInfoOuterClass.IrodoriInfo.newBuilder((emu.grasscutter.net.proto.IrodoriInfoOuterClass.IrodoriInfo) iKJIPGGMNBK_)
                .mergeFrom(value).buildPartial();
          } else {
            iKJIPGGMNBK_ = value;
          }
          onChanged();
        } else {
          if (iKJIPGGMNBKCase_ == 1014) {
            irodoriInfoBuilder_.mergeFrom(value);
          }
          irodoriInfoBuilder_.setMessage(value);
        }
        iKJIPGGMNBKCase_ = 1014;
        return this;
      }

/**
       * <code>.IrodoriInfo irodori_info = 1014;</code>
       */


@java.lang.Override
    public emu.grasscutter.net.proto.FungusTrainingPoolPreviewDetailOuterClass.FungusTrainingPoolPreviewDetail getMonsterPoolPreviewList(int index) {
      return monsterPoolPreviewList_.get(index);
    }

/**
     * repeated .FungusTrainingPoolPreviewDetail monsterPoolPreviewList = 9;
     */


public Builder addDailyInfoList(
          int index, emu.grasscutter.net.proto.EffigyDailyInfoOuterClass.EffigyDailyInfo value) {
        if (dailyInfoListBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureDailyInfoListIsMutable();
          dailyInfoList_.add(index, value);
          onChanged();
        } else {
          dailyInfoListBuilder_.addMessage(index, value);
        }
        return this;
      }

/**
       * repeated .EffigyDailyInfo daily_info_list = 4;
       */


@java.lang.Override
    public int getBuyCount() {
      return buyCount_;
    }

/**
     * uint32 buyCount = 11;
     * @return The buyCount.
     */


@java.lang.Override
    public int getDifficultyId() {
      return difficultyId_;
    }

/**
     * uint32 difficulty_id = 3;
     * @return The difficultyId.
     */


public Builder setRetcode(int value) {

        retcode_ = value;
        onChanged();
        return this;
      }

/**
       * int32 retcode = 2;
       * @param value The retcode to set.
       * @return This builder for chaining.
       */


public Builder setRemainUidList(
          int index, int value) {
        ensureRemainUidListIsMutable();
        remainUidList_.setInt(index, value);
        onChanged();
        return this;
      }

/**
       * repeated uint32 remainUidList = 2;
       * @param index The index to set the value at.
       * @param value The remainUidList to set.
       * @return This builder for chaining.
       */


public Builder setUgcGuid(long value) {

        ugcGuid_ = value;
        onChanged();
        return this;
      }

/**
       * uint64 ugcGuid = 8;
       * @param value The ugcGuid to set.
       * @return This builder for chaining.
       */


public emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture getProfilePicture() {
        if (profilePictureBuilder_ == null) {
          return profilePicture_ == null ? emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture.getDefaultInstance() : profilePicture_;
        } else {
          return profilePictureBuilder_.getMessage();
        }
      }

/**
       * <code>.ProfilePicture profilePicture = 13;</code>
       * @return The profilePicture.
       */


public Builder setGadgetState(int value) {

        gadgetState_ = value;
        onChanged();
        return this;
      }

/**
       * uint32 gadgetState = 6;
       * @param value The gadgetState to set.
       * @return This builder for chaining.
       */


@java.lang.Override
    public emu.grasscutter.net.proto.StatueGadgetInfoOuterClass.StatueGadgetInfoOrBuilder getStatueGadgetOrBuilder() {
      if (contentCase_ == 19) {
         return (emu.grasscutter.net.proto.StatueGadgetInfoOuterClass.StatueGadgetInfo) content_;
      }
      return emu.grasscutter.net.proto.StatueGadgetInfoOuterClass.StatueGadgetInfo.getDefaultInstance();
    }

/**
     * <code>.StatueGadgetInfo statue_gadget = 19;</code>
     */


public Builder setPhotoInfo(emu.grasscutter.net.proto.GravenInnocencePhotoInfoOuterClass.GravenInnocencePhotoInfo value) {
        if (photoInfoBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          photoInfo_ = value;
          onChanged();
        } else {
          photoInfoBuilder_.setMessage(value);
        }

        return this;
      }

/**
       * <code>.GravenInnocencePhotoInfo photo_info = 10;</code>
       */


public Builder setPhotoInfo(
          emu.grasscutter.net.proto.GravenInnocencePhotoInfoOuterClass.GravenInnocencePhotoInfo.Builder builderForValue) {
        if (photoInfoBuilder_ == null) {
          photoInfo_ = builderForValue.build();
          onChanged();
        } else {
          photoInfoBuilder_.setMessage(builderForValue.build());
        }

        return this;
      }


@java.lang.Override
    public int getStageId() {
      return stageId_;
    }

/**
     * uint32 stageId = 10;
     * @return The stageId.
     */


public java.lang.String getClientParams() {
        java.lang.Object ref = clientParams_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          clientParams_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

/**
       * string clientParams = 10;
       * @return The clientParams.
       */


public emu.grasscutter.net.proto.BlossomBriefInfoOuterClass.BlossomBriefInfo.Builder getBriefInfoListBuilder(
          int index) {
        return getBriefInfoListFieldBuilder().getBuilder(index);
      }

/**
       * repeated .BlossomBriefInfo briefInfoList = 9;
       */


public Builder setSchemeData(emu.grasscutter.net.proto.FireworksLaunchSchemeDataOuterClass.FireworksLaunchSchemeData value) {
        if (schemeDataBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          schemeData_ = value;
          onChanged();
        } else {
          schemeDataBuilder_.setMessage(value);
        }

        return this;
      }

/**
       * <code>.FireworksLaunchSchemeData schemeData = 1;</code>
       */


@java.lang.Override
    public emu.grasscutter.net.proto.MonsterRouteOuterClass.MonsterRouteOrBuilder getMonsterRouteOrBuilder() {
      return getMonsterRoute();
    }

/**
     * <code>.MonsterRoute monsterRoute = 2;</code>
     */


@java.lang.Override
    public boolean getIsHaveProgress() {
      return isHaveProgress_;
    }

/**
     * bool isHaveProgress = 13;
     * @return The isHaveProgress.
     */


public Builder addConfigIdList(int value) {
        ensureConfigIdListIsMutable();
        configIdList_.addInt(value);
        onChanged();
        return this;
      }

/**
       * repeated uint32 configIdList = 12;
       * @param value The configIdList to add.
       * @return This builder for chaining.
       */


@java.lang.Override
    public java.util.List<? extends emu.grasscutter.net.proto.ServerBuffOuterClass.ServerBuffOrBuilder>
        getServerBuffListOrBuilderList() {
      return serverBuffList_;
    }

/**
     * repeated .ServerBuff serverBuffList = 12;
     */


public int getAvatarGuidListCount() {
      return avatarGuidList_.size();
    }

/**
     * repeated uint64 avatarGuidList = 10;
     * @return The count of avatarGuidList.
     */


@java.lang.Override
    public int getObtainLimit() {
      return obtainLimit_;
    }

/**
     * uint32 obtainLimit = 4;
     * @return The obtainLimit.
     */


public Builder setRetcode(int value) {

        retcode_ = value;
        onChanged();
        return this;
      }

/**
       * int32 retcode = 5;
       * @param value The retcode to set.
       * @return This builder for chaining.
       */


@java.lang.Override
    public emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief getAskFriendList(int index) {
      return askFriendList_.get(index);
    }

/**
     * repeated .FriendBrief askFriendList = 6;
     */


@java.lang.Override
    public java.util.List<java.lang.Integer>
        getRemainUidListList() {
      return remainUidList_;
    }

/**
     * repeated uint32 remainUidList = 3;
     * @return A list containing the remainUidList.
     */


public Builder clearUnk3300ILELLFNPDFJ() {
        if (unk3300ILELLFNPDFJBuilder_ == null) {
          unk3300ILELLFNPDFJ_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          unk3300ILELLFNPDFJBuilder_.clear();
        }
        return this;
      }

/**
       * repeated .ItemParam Unk3300_ILELLFNPDFJ = 9;
       */


@java.lang.Override
    public java.util.List<? extends emu.grasscutter.net.proto.ParkourLevelInfoOuterClass.ParkourLevelInfoOrBuilder>
        getParkourLevelInfoListOrBuilderList() {
      return parkourLevelInfoList_;
    }

/**
     * repeated .ParkourLevelInfo parkourLevelInfoList = 6;
     */


public Builder clearMainHouse() {
        if (mainHouseBuilder_ == null) {
          mainHouse_ = null;
          onChanged();
        } else {
          mainHouse_ = null;
          mainHouseBuilder_ = null;
        }

        return this;
      }

/**
       * <code>.HomeFurnitureData mainHouse = 6;</code>
       */


public Builder addUnk3300ABHHACBDCFI(int value) {
        ensureUnk3300ABHHACBDCFIIsMutable();
        unk3300ABHHACBDCFI_.addInt(value);
        onChanged();
        return this;
      }

/**
       * repeated uint32 Unk3300_ABHHACBDCFI = 3;
       * @param value The unk3300ABHHACBDCFI to add.
       * @return This builder for chaining.
       */


public Builder clearUnk3300KJDEFIBKBPE() {

        unk3300KJDEFIBKBPE_ = false;
        onChanged();
        return this;
      }

/**
       * bool Unk3300_KJDEFIBKBPE = 5;
       * @return This builder for chaining.
       */


@java.lang.Override
    public int getCount() {
      return count_;
    }

/**
     * uint32 count = 1;
     * @return The count.
     */


public Builder putPropMap(
          int key,
          emu.grasscutter.net.proto.PropValueOuterClass.PropValue value) {

        if (value == null) { throw new java.lang.NullPointerException(); }
        internalGetMutablePropMap().getMutableMap()
            .put(key, value);
        return this;
      }

/**
       * map<uint32, .PropValue> propMap = 5;
       */


public Builder setClientVerisonHash(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }

        clientVerisonHash_ = value;
        onChanged();
        return this;
      }

/**
       * string clientVerisonHash = 1765;
       * @param value The clientVerisonHash to set.
       * @return This builder for chaining.
       */


@java.lang.Override
    public emu.grasscutter.net.proto.VectorOuterClass.Vector getRot() {
      return rot_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : rot_;
    }

/**
     * <code>.Vector rot = 13;</code>
     * @return The rot.
     */


public Builder setResVersionConfig(
          emu.grasscutter.net.proto.ResVersionConfigOuterClass.ResVersionConfig.Builder builderForValue) {
        if (resVersionConfigBuilder_ == null) {
          resVersionConfig_ = builderForValue.build();
          onChanged();
        } else {
          resVersionConfigBuilder_.setMessage(builderForValue.build());
        }

        return this;
      }

/**
       * <code>.ResVersionConfig res_version_config = 22;</code>
       */


public java.lang.String getContentMsg() {
        java.lang.Object ref = contentMsg_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          contentMsg_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

/**
       * string contentMsg = 4;
       * @return The contentMsg.
       */