Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | /****************************************************************************** |
7 | /****************************************************************************** |
8 | * |
8 | * |
9 | * 1. Copyright Notice |
9 | * 1. Copyright Notice |
10 | * |
10 | * |
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
12 | * All rights reserved. |
12 | * All rights reserved. |
13 | * |
13 | * |
14 | * 2. License |
14 | * 2. License |
15 | * |
15 | * |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
Line 115... | Line 115... | ||
115 | 115 | ||
Line 116... | Line 116... | ||
116 | 116 | ||
117 | #include "aslcompiler.h" |
117 | #include "aslcompiler.h" |
- | 118 | #include "aslcompiler.y.h" |
|
Line 118... | Line 119... | ||
118 | #include "aslcompiler.y.h" |
119 | #include |
119 | 120 | ||
Line 120... | Line 121... | ||
120 | #define _COMPONENT ACPI_COMPILER |
121 | #define _COMPONENT ACPI_COMPILER |
Line 473... | Line 474... | ||
473 | 474 | ||
Line 474... | Line 475... | ||
474 | 475 | ||
475 | /******************************************************************************* |
476 | /******************************************************************************* |
- | 477 | * |
|
- | 478 | * FUNCTION: TrCreateConstantLeafNode |
|
- | 479 | * |
|
- | 480 | * PARAMETERS: ParseOpcode - The constant opcode |
|
- | 481 | * |
|
- | 482 | * RETURN: Pointer to the new node. Aborts on allocation failure |
|
- | 483 | * |
|
- | 484 | * DESCRIPTION: Create a leaf node (no children or peers) for one of the |
|
- | 485 | * special constants - __LINE__, __FILE__, and __DATE__. |
|
- | 486 | * |
|
- | 487 | * Note: An implemenation of __FUNC__ cannot happen here because we don't |
|
- | 488 | * have a full parse tree at this time and cannot find the parent control |
|
- | 489 | * method. If it is ever needed, __FUNC__ must be implemented later, after |
|
- | 490 | * the parse tree has been fully constructed. |
|
- | 491 | * |
|
- | 492 | ******************************************************************************/ |
|
- | 493 | ||
- | 494 | ACPI_PARSE_OBJECT * |
|
- | 495 | TrCreateConstantLeafNode ( |
|
- | 496 | UINT32 ParseOpcode) |
|
- | 497 | { |
|
- | 498 | ACPI_PARSE_OBJECT *Op = NULL; |
|
- | 499 | time_t CurrentTime; |
|
- | 500 | char *StaticTimeString; |
|
- | 501 | char *TimeString; |
|
- | 502 | ||
- | 503 | ||
- | 504 | switch (ParseOpcode) |
|
- | 505 | { |
|
- | 506 | case PARSEOP___LINE__: |
|
- | 507 | Op = TrAllocateNode (PARSEOP_INTEGER); |
|
- | 508 | Op->Asl.Value.Integer = Op->Asl.LineNumber; |
|
- | 509 | break; |
|
- | 510 | ||
- | 511 | case PARSEOP___FILE__: |
|
- | 512 | Op = TrAllocateNode (PARSEOP_STRING_LITERAL); |
|
- | 513 | ||
- | 514 | /* Op.Asl.Filename contains the full pathname to the file */ |
|
- | 515 | ||
- | 516 | Op->Asl.Value.String = Op->Asl.Filename; |
|
- | 517 | break; |
|
- | 518 | ||
- | 519 | case PARSEOP___DATE__: |
|
- | 520 | Op = TrAllocateNode (PARSEOP_STRING_LITERAL); |
|
- | 521 | ||
- | 522 | /* Get a copy of the current time */ |
|
- | 523 | ||
- | 524 | CurrentTime = time (NULL); |
|
- | 525 | StaticTimeString = ctime (&CurrentTime); |
|
- | 526 | TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1); |
|
- | 527 | strcpy (TimeString, StaticTimeString); |
|
- | 528 | ||
- | 529 | TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */ |
|
- | 530 | Op->Asl.Value.String = TimeString; |
|
- | 531 | break; |
|
- | 532 | ||
- | 533 | default: /* This would be an internal error */ |
|
- | 534 | return (NULL); |
|
- | 535 | } |
|
- | 536 | ||
- | 537 | DbgPrint (ASL_PARSE_OUTPUT, |
|
- | 538 | "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ", |
|
- | 539 | Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode), |
|
- | 540 | ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); |
|
- | 541 | return (Op); |
|
- | 542 | } |
|
- | 543 | ||
- | 544 | ||
- | 545 | /******************************************************************************* |
|
476 | * |
546 | * |
477 | * FUNCTION: TrCreateValuedLeafNode |
547 | * FUNCTION: TrCreateValuedLeafNode |
478 | * |
548 | * |
479 | * PARAMETERS: ParseOpcode - New opcode to be assigned to the node |
549 | * PARAMETERS: ParseOpcode - New opcode to be assigned to the node |
480 | * Value - Value to be assigned to the node |
550 | * Value - Value to be assigned to the node |