示例#1
0
BOOL RenderStack::Push(AttributeValue *pAttr, BOOL Temporary)
{
	// If we're saving an attribute that hasn't been set up yet, don't bother.
	if (pAttr == NULL)
		return TRUE;

	// If we need more space, then get some.
	if (Top == StackLimit)
	{
		if (!GrowStack())
			return FALSE;
	}

	// Push the record onto the stack
	TheStack[Top].pAttrValue   = pAttr;
	TheStack[Top].ContextLevel = ContextLevel;
	TheStack[Top].Temporary    = Temporary;

	// Sanity checks
	CC_ASSERT_VALID(pAttr);
	ENSURE((Temporary == TRUE) || (Temporary == FALSE), 
		   "Duff Temporary flag passed to Push()");
		
	// Move stack pointer to next record
	Top++;

	// Worked ok
	return TRUE;
}
示例#2
0
文件: Expression.c 项目: Kohrara/edk
EFI_STATUS
PushStack (
  IN OUT EFI_HII_VALUE       **Stack,
  IN OUT EFI_HII_VALUE       **StackPtr,
  IN OUT EFI_HII_VALUE       **StackEnd,
  IN EFI_HII_VALUE           *Data
  )
/*++

Routine Description:
  Push an element onto the Boolean Stack

Arguments:
  Stack     - On input: old stack; On output: new stack
  StackPtr  - On input: old stack pointer; On output: new stack pointer
  StackEnd  - On input: old stack end; On output: new stack end
  Data      - Data to push.

Returns:
  EFI_SUCCESS - Push stack success.

--*/
{
  EFI_STATUS  Status;

  //
  // Check for a stack overflow condition
  //
  if (*StackPtr >= *StackEnd) {
    //
    // Grow the stack
    //
    Status = GrowStack (Stack, StackPtr, StackEnd);
    if (EFI_ERROR (Status)) {
      return Status;
    }
  }

  //
  // Push the item onto the stack
  //
  EfiCopyMem (*StackPtr, Data, sizeof (EFI_HII_VALUE));
  *StackPtr = *StackPtr + 1;

  return EFI_SUCCESS;
}