Deleted Added
full compact
47a48
> #include <time.h>
405a407,475
> * FUNCTION: TrCreateConstantLeafNode
> *
> * PARAMETERS: ParseOpcode - The constant opcode
> *
> * RETURN: Pointer to the new node. Aborts on allocation failure
> *
> * DESCRIPTION: Create a leaf node (no children or peers) for one of the
> * special constants - __LINE__, __FILE__, and __DATE__.
> *
> * Note: An implemenation of __FUNC__ cannot happen here because we don't
> * have a full parse tree at this time and cannot find the parent control
> * method. If it is ever needed, __FUNC__ must be implemented later, after
> * the parse tree has been fully constructed.
> *
> ******************************************************************************/
>
> ACPI_PARSE_OBJECT *
> TrCreateConstantLeafNode (
> UINT32 ParseOpcode)
> {
> ACPI_PARSE_OBJECT *Op = NULL;
> time_t CurrentTime;
> char *StaticTimeString;
> char *TimeString;
>
>
> switch (ParseOpcode)
> {
> case PARSEOP___LINE__:
> Op = TrAllocateNode (PARSEOP_INTEGER);
> Op->Asl.Value.Integer = Op->Asl.LineNumber;
> break;
>
> case PARSEOP___FILE__:
> Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
>
> /* Op.Asl.Filename contains the full pathname to the file */
>
> Op->Asl.Value.String = Op->Asl.Filename;
> break;
>
> case PARSEOP___DATE__:
> Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
>
> /* Get a copy of the current time */
>
> CurrentTime = time (NULL);
> StaticTimeString = ctime (&CurrentTime);
> TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
> strcpy (TimeString, StaticTimeString);
>
> TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
> Op->Asl.Value.String = TimeString;
> break;
>
> default: /* This would be an internal error */
> return (NULL);
> }
>
> DbgPrint (ASL_PARSE_OUTPUT,
> "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
> Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
> ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
> return (Op);
> }
>
>
> /*******************************************************************************
> *