9,7 → 9,7 |
* |
* 1. Copyright Notice |
* |
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
* All rights reserved. |
* |
* 2. License |
117,6 → 117,7 |
|
#include "aslcompiler.h" |
#include "aslcompiler.y.h" |
#include <time.h> |
|
#define _COMPONENT ACPI_COMPILER |
ACPI_MODULE_NAME ("asltree") |
475,6 → 476,75 |
|
/******************************************************************************* |
* |
* 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); |
} |
|
|
/******************************************************************************* |
* |
* FUNCTION: TrCreateValuedLeafNode |
* |
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node |