| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
#include "aslcompiler.h" |
| 45 |
#include "aslcompiler.y.h" |
| 46 |
#include "amlcode.h" |
| 47 |
#include "acapps.h" |
| 48 |
#include "acconvert.h" |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
void |
| 68 |
CvProcessComment ( |
| 69 |
ASL_COMMENT_STATE CurrentState, |
| 70 |
char *StringBuffer, |
| 71 |
int c1) |
| 72 |
{ |
| 73 |
UINT64 i; |
| 74 |
char *LineToken; |
| 75 |
char *FinalLineToken; |
| 76 |
BOOLEAN CharStart; |
| 77 |
char *CommentString; |
| 78 |
char *FinalCommentString; |
| 79 |
|
| 80 |
|
| 81 |
if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) |
| 82 |
{ |
| 83 |
*StringBuffer = (char) c1; |
| 84 |
++StringBuffer; |
| 85 |
*StringBuffer = 0; |
| 86 |
|
| 87 |
CvDbgPrint ("Multi-line comment\n"); |
| 88 |
CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1); |
| 89 |
strcpy (CommentString, AslGbl_MsgBuffer); |
| 90 |
|
| 91 |
CvDbgPrint ("CommentString: %s\n", CommentString); |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
LineToken = strtok (CommentString, "\n"); |
| 100 |
|
| 101 |
if (LineToken) |
| 102 |
{ |
| 103 |
FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1); |
| 104 |
strcpy (FinalLineToken, LineToken); |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D) |
| 109 |
{ |
| 110 |
FinalLineToken[strlen(FinalLineToken)-1] = 0; |
| 111 |
} |
| 112 |
|
| 113 |
CvAddToCommentList (FinalLineToken); |
| 114 |
LineToken = strtok (NULL, "\n"); |
| 115 |
while (LineToken != NULL) |
| 116 |
{ |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
CharStart = FALSE; |
| 123 |
for (i = 0; (i < (strlen (LineToken) + 1)) && !CharStart; i++) |
| 124 |
{ |
| 125 |
if (LineToken[i] != ' ' && LineToken[i] != '\t') |
| 126 |
{ |
| 127 |
CharStart = TRUE; |
| 128 |
LineToken += i-1; |
| 129 |
LineToken [0] = ' '; |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1); |
| 134 |
strcat (FinalLineToken, LineToken); |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D) |
| 139 |
{ |
| 140 |
FinalLineToken[strlen(FinalLineToken) - 1] = 0; |
| 141 |
} |
| 142 |
|
| 143 |
CvAddToCommentList (FinalLineToken); |
| 144 |
LineToken = strtok (NULL,"\n"); |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
else |
| 156 |
{ |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
FinalCommentString = |
| 163 |
UtLocalCacheCalloc (strlen (CommentString) + |
| 164 |
CurrentState.SpacesBefore + 1); |
| 165 |
|
| 166 |
for (i = 0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) && |
| 167 |
(i < CurrentState.SpacesBefore); i++) |
| 168 |
{ |
| 169 |
FinalCommentString[i] = ' '; |
| 170 |
} |
| 171 |
|
| 172 |
strcat (FinalCommentString, CommentString); |
| 173 |
CvPlaceComment (CurrentState.CommentType, FinalCommentString); |
| 174 |
} |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
void |
| 195 |
CvProcessCommentType2 ( |
| 196 |
ASL_COMMENT_STATE CurrentState, |
| 197 |
char *StringBuffer) |
| 198 |
{ |
| 199 |
UINT32 i; |
| 200 |
char *CommentString; |
| 201 |
char *FinalCommentString; |
| 202 |
|
| 203 |
|
| 204 |
if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) |
| 205 |
{ |
| 206 |
*StringBuffer = 0; |
| 207 |
CvDbgPrint ("Single-line comment\n"); |
| 208 |
CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1); |
| 209 |
strcpy (CommentString, AslGbl_MsgBuffer); |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
FinalCommentString = UtLocalCacheCalloc (CurrentState.SpacesBefore + |
| 238 |
strlen (CommentString) + 3 + 1); |
| 239 |
|
| 240 |
for (i = 0; (CurrentState.CommentType != 1) && |
| 241 |
(i < CurrentState.SpacesBefore); i++) |
| 242 |
{ |
| 243 |
FinalCommentString[i] = ' '; |
| 244 |
} |
| 245 |
|
| 246 |
strcat (FinalCommentString, CommentString); |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
strcat (FinalCommentString, " */"); |
| 251 |
FinalCommentString [CurrentState.SpacesBefore + |
| 252 |
strlen (CommentString) + 3] = 0; |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
if (FinalCommentString[strlen (FinalCommentString) - 1] == 0x0D) |
| 257 |
{ |
| 258 |
FinalCommentString[strlen(FinalCommentString) - 1] = 0; |
| 259 |
} |
| 260 |
|
| 261 |
CvPlaceComment (CurrentState.CommentType, FinalCommentString); |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
UINT32 |
| 282 |
CvCalculateCommentLengths( |
| 283 |
ACPI_PARSE_OBJECT *Op) |
| 284 |
{ |
| 285 |
UINT32 CommentLength = 0; |
| 286 |
UINT32 TotalCommentLength = 0; |
| 287 |
ACPI_COMMENT_NODE *Current = NULL; |
| 288 |
|
| 289 |
|
| 290 |
if (!AcpiGbl_CaptureComments) |
| 291 |
{ |
| 292 |
return (0); |
| 293 |
} |
| 294 |
|
| 295 |
CvDbgPrint ("==Calculating comment lengths for %s\n", |
| 296 |
Op->Asl.ParseOpName); |
| 297 |
|
| 298 |
if (Op->Asl.FileChanged) |
| 299 |
{ |
| 300 |
TotalCommentLength += strlen (Op->Asl.Filename) + 3; |
| 301 |
|
| 302 |
if (Op->Asl.ParentFilename && |
| 303 |
AcpiUtStricmp (Op->Asl.Filename, Op->Asl.ParentFilename)) |
| 304 |
{ |
| 305 |
TotalCommentLength += strlen (Op->Asl.ParentFilename) + 3; |
| 306 |
} |
| 307 |
} |
| 308 |
|
| 309 |
if (Op->Asl.CommentList) |
| 310 |
{ |
| 311 |
Current = Op->Asl.CommentList; |
| 312 |
while (Current) |
| 313 |
{ |
| 314 |
CommentLength = strlen (Current->Comment)+3; |
| 315 |
CvDbgPrint ("Length of standard comment: %d\n", CommentLength); |
| 316 |
CvDbgPrint (" Comment string: %s\n\n", Current->Comment); |
| 317 |
TotalCommentLength += CommentLength; |
| 318 |
Current = Current->Next; |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
if (Op->Asl.EndBlkComment) |
| 323 |
{ |
| 324 |
Current = Op->Asl.EndBlkComment; |
| 325 |
while (Current) |
| 326 |
{ |
| 327 |
CommentLength = strlen (Current->Comment)+3; |
| 328 |
CvDbgPrint ("Length of endblkcomment: %d\n", CommentLength); |
| 329 |
CvDbgPrint (" Comment string: %s\n\n", Current->Comment); |
| 330 |
TotalCommentLength += CommentLength; |
| 331 |
Current = Current->Next; |
| 332 |
} |
| 333 |
} |
| 334 |
|
| 335 |
if (Op->Asl.InlineComment) |
| 336 |
{ |
| 337 |
CommentLength = strlen (Op->Asl.InlineComment)+3; |
| 338 |
CvDbgPrint ("Length of inline comment: %d\n", CommentLength); |
| 339 |
CvDbgPrint (" Comment string: %s\n\n", Op->Asl.InlineComment); |
| 340 |
TotalCommentLength += CommentLength; |
| 341 |
} |
| 342 |
|
| 343 |
if (Op->Asl.EndNodeComment) |
| 344 |
{ |
| 345 |
CommentLength = strlen(Op->Asl.EndNodeComment)+3; |
| 346 |
CvDbgPrint ("Length of end node comment +3: %d\n", CommentLength); |
| 347 |
CvDbgPrint (" Comment string: %s\n\n", Op->Asl.EndNodeComment); |
| 348 |
TotalCommentLength += CommentLength; |
| 349 |
} |
| 350 |
|
| 351 |
if (Op->Asl.CloseBraceComment) |
| 352 |
{ |
| 353 |
CommentLength = strlen (Op->Asl.CloseBraceComment)+3; |
| 354 |
CvDbgPrint ("Length of close brace comment: %d\n", CommentLength); |
| 355 |
CvDbgPrint (" Comment string: %s\n\n", Op->Asl.CloseBraceComment); |
| 356 |
TotalCommentLength += CommentLength; |
| 357 |
} |
| 358 |
|
| 359 |
CvDbgPrint("\n\n"); |
| 360 |
return (TotalCommentLength); |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
void |
| 382 |
CgWriteAmlDefBlockComment( |
| 383 |
ACPI_PARSE_OBJECT *Op) |
| 384 |
{ |
| 385 |
UINT8 CommentOption; |
| 386 |
ACPI_COMMENT_NODE *Current; |
| 387 |
char *NewFilename; |
| 388 |
char *Position; |
| 389 |
char *DirectoryPosition; |
| 390 |
|
| 391 |
|
| 392 |
if (!AcpiGbl_CaptureComments || |
| 393 |
(Op->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK)) |
| 394 |
{ |
| 395 |
return; |
| 396 |
} |
| 397 |
|
| 398 |
CvDbgPrint ("Printing comments for a definition block..\n"); |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
NewFilename = UtLocalCacheCalloc (strlen (Op->Asl.Filename)); |
| 403 |
strcpy (NewFilename, Op->Asl.Filename); |
| 404 |
DirectoryPosition = strrchr (NewFilename, '/'); |
| 405 |
Position = strrchr (NewFilename, '.'); |
| 406 |
|
| 407 |
if (Position && (Position > DirectoryPosition)) |
| 408 |
{ |
| 409 |
|
| 410 |
|
| 411 |
Position++; |
| 412 |
*Position = 0; |
| 413 |
strcat (Position, FILE_SUFFIX_DISASSEMBLY); |
| 414 |
} |
| 415 |
else |
| 416 |
{ |
| 417 |
|
| 418 |
|
| 419 |
strcat (NewFilename, "."); |
| 420 |
strcat (NewFilename, FILE_SUFFIX_DISASSEMBLY); |
| 421 |
} |
| 422 |
|
| 423 |
CommentOption = FILENAME_COMMENT; |
| 424 |
CgWriteOneAmlComment(Op, NewFilename, CommentOption); |
| 425 |
|
| 426 |
Current = Op->Asl.CommentList; |
| 427 |
CommentOption = STD_DEFBLK_COMMENT; |
| 428 |
|
| 429 |
while (Current) |
| 430 |
{ |
| 431 |
CgWriteOneAmlComment(Op, Current->Comment, CommentOption); |
| 432 |
CvDbgPrint ("Printing comment: %s\n", Current->Comment); |
| 433 |
Current = Current->Next; |
| 434 |
} |
| 435 |
|
| 436 |
Op->Asl.CommentList = NULL; |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
if (Op->Asl.CloseBraceComment) |
| 441 |
{ |
| 442 |
CommentOption = END_DEFBLK_COMMENT; |
| 443 |
CgWriteOneAmlComment(Op, Op->Asl.CloseBraceComment, CommentOption); |
| 444 |
Op->Asl.CloseBraceComment = NULL; |
| 445 |
} |
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
void |
| 464 |
CgWriteOneAmlComment( |
| 465 |
ACPI_PARSE_OBJECT *Op, |
| 466 |
char* CommentToPrint, |
| 467 |
UINT8 InputOption) |
| 468 |
{ |
| 469 |
UINT8 CommentOption = InputOption; |
| 470 |
UINT8 CommentOpcode = (UINT8) AML_COMMENT_OP; |
| 471 |
|
| 472 |
|
| 473 |
if (!CommentToPrint) |
| 474 |
{ |
| 475 |
return; |
| 476 |
} |
| 477 |
|
| 478 |
CgLocalWriteAmlData (Op, &CommentOpcode, 1); |
| 479 |
CgLocalWriteAmlData (Op, &CommentOption, 1); |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
CgLocalWriteAmlData (Op, CommentToPrint, strlen (CommentToPrint) + 1); |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
void |
| 500 |
CgWriteAmlComment( |
| 501 |
ACPI_PARSE_OBJECT *Op) |
| 502 |
{ |
| 503 |
ACPI_COMMENT_NODE *Current; |
| 504 |
UINT8 CommentOption; |
| 505 |
char *NewFilename; |
| 506 |
char *ParentFilename; |
| 507 |
|
| 508 |
|
| 509 |
if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) || |
| 510 |
!AcpiGbl_CaptureComments) |
| 511 |
{ |
| 512 |
return; |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
if (Op->Asl.FileChanged) |
| 518 |
{ |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
NewFilename = |
| 523 |
FlGenerateFilename (Op->Asl.Filename, FILE_SUFFIX_DISASSEMBLY); |
| 524 |
if (NewFilename) |
| 525 |
{ |
| 526 |
CvDbgPrint ("Writing file comment, \"%s\" for %s\n", |
| 527 |
NewFilename, Op->Asl.ParseOpName); |
| 528 |
} |
| 529 |
|
| 530 |
CgWriteOneAmlComment(Op, NewFilename, FILENAME_COMMENT); |
| 531 |
|
| 532 |
if (Op->Asl.ParentFilename && |
| 533 |
AcpiUtStricmp (Op->Asl.ParentFilename, Op->Asl.Filename)) |
| 534 |
{ |
| 535 |
ParentFilename = FlGenerateFilename (Op->Asl.ParentFilename, |
| 536 |
FILE_SUFFIX_DISASSEMBLY); |
| 537 |
CgWriteOneAmlComment(Op, ParentFilename, PARENTFILENAME_COMMENT); |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
Op->Asl.FileChanged = FALSE; |
| 543 |
} |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
Current = Op->Asl.CommentList; |
| 551 |
if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) |
| 552 |
{ |
| 553 |
CommentOption = INCLUDE_COMMENT; |
| 554 |
} |
| 555 |
else |
| 556 |
{ |
| 557 |
CommentOption = STANDARD_COMMENT; |
| 558 |
} |
| 559 |
|
| 560 |
while (Current) |
| 561 |
{ |
| 562 |
CgWriteOneAmlComment(Op, Current->Comment, CommentOption); |
| 563 |
Current = Current->Next; |
| 564 |
} |
| 565 |
|
| 566 |
Op->Asl.CommentList = NULL; |
| 567 |
|
| 568 |
Current = Op->Asl.EndBlkComment; |
| 569 |
CommentOption = ENDBLK_COMMENT; |
| 570 |
while (Current) |
| 571 |
{ |
| 572 |
CgWriteOneAmlComment(Op, Current->Comment, CommentOption); |
| 573 |
Current = Current->Next; |
| 574 |
} |
| 575 |
|
| 576 |
Op->Asl.EndBlkComment = NULL; |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
if (Op->Asl.InlineComment) |
| 581 |
{ |
| 582 |
CommentOption = INLINE_COMMENT; |
| 583 |
CgWriteOneAmlComment(Op, Op->Asl.InlineComment, CommentOption); |
| 584 |
Op->Asl.InlineComment = NULL; |
| 585 |
} |
| 586 |
|
| 587 |
if (Op->Asl.EndNodeComment) |
| 588 |
{ |
| 589 |
CommentOption = ENDNODE_COMMENT; |
| 590 |
CgWriteOneAmlComment(Op, Op->Asl.EndNodeComment, CommentOption); |
| 591 |
Op->Asl.EndNodeComment = NULL; |
| 592 |
} |
| 593 |
|
| 594 |
if (Op->Asl.CloseBraceComment) |
| 595 |
{ |
| 596 |
CommentOption = CLOSE_BRACE_COMMENT; |
| 597 |
CgWriteOneAmlComment(Op, Op->Asl.CloseBraceComment, CommentOption); |
| 598 |
Op->Asl.CloseBraceComment = NULL; |
| 599 |
} |
| 600 |
} |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
ACPI_COMMENT_NODE * |
| 616 |
CvCommentNodeCalloc ( |
| 617 |
void) |
| 618 |
{ |
| 619 |
ACPI_COMMENT_NODE *NewCommentNode; |
| 620 |
|
| 621 |
|
| 622 |
NewCommentNode = UtLocalCalloc (sizeof (ACPI_COMMENT_NODE)); |
| 623 |
NewCommentNode->Next = NULL; |
| 624 |
return (NewCommentNode); |
| 625 |
} |
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
UINT32 |
| 643 |
CvParseOpBlockType ( |
| 644 |
ACPI_PARSE_OBJECT *Op) |
| 645 |
{ |
| 646 |
|
| 647 |
if (!Op) |
| 648 |
{ |
| 649 |
return (BLOCK_NONE); |
| 650 |
} |
| 651 |
|
| 652 |
switch (Op->Asl.ParseOpcode) |
| 653 |
{ |
| 654 |
|
| 655 |
|
| 656 |
case PARSEOP_VAR_PACKAGE: |
| 657 |
case PARSEOP_BANKFIELD: |
| 658 |
case PARSEOP_BUFFER: |
| 659 |
case PARSEOP_CASE: |
| 660 |
case PARSEOP_DEVICE: |
| 661 |
case PARSEOP_FIELD: |
| 662 |
case PARSEOP_FOR: |
| 663 |
case PARSEOP_FUNCTION: |
| 664 |
case PARSEOP_IF: |
| 665 |
case PARSEOP_ELSEIF: |
| 666 |
case PARSEOP_INDEXFIELD: |
| 667 |
case PARSEOP_METHOD: |
| 668 |
case PARSEOP_POWERRESOURCE: |
| 669 |
case PARSEOP_PROCESSOR: |
| 670 |
case PARSEOP_DATABUFFER: |
| 671 |
case PARSEOP_SCOPE: |
| 672 |
case PARSEOP_SWITCH: |
| 673 |
case PARSEOP_THERMALZONE: |
| 674 |
case PARSEOP_WHILE: |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
case PARSEOP_RESOURCETEMPLATE: |
| 679 |
case PARSEOP_VENDORLONG: |
| 680 |
case PARSEOP_VENDORSHORT: |
| 681 |
case PARSEOP_INTERRUPT: |
| 682 |
case PARSEOP_IRQNOFLAGS: |
| 683 |
case PARSEOP_IRQ: |
| 684 |
case PARSEOP_GPIO_INT: |
| 685 |
case PARSEOP_GPIO_IO: |
| 686 |
case PARSEOP_DMA: |
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
case PARSEOP_DEFINITION_BLOCK: |
| 691 |
return (BLOCK_PAREN | BLOCK_BRACE); |
| 692 |
|
| 693 |
default: |
| 694 |
return (BLOCK_NONE); |
| 695 |
} |
| 696 |
} |
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
void |
| 714 |
CvProcessCommentState ( |
| 715 |
char Input) |
| 716 |
{ |
| 717 |
|
| 718 |
if (Input != ' ') |
| 719 |
{ |
| 720 |
AslGbl_CommentState.SpacesBefore = 0; |
| 721 |
} |
| 722 |
|
| 723 |
switch (Input) |
| 724 |
{ |
| 725 |
case '\n': |
| 726 |
|
| 727 |
AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD; |
| 728 |
break; |
| 729 |
|
| 730 |
case ' ': |
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
AslGbl_CommentState.SpacesBefore++; |
| 735 |
break; |
| 736 |
|
| 737 |
case '(': |
| 738 |
|
| 739 |
AslGbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN; |
| 740 |
break; |
| 741 |
|
| 742 |
case ')': |
| 743 |
|
| 744 |
AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN; |
| 745 |
break; |
| 746 |
|
| 747 |
case '{': |
| 748 |
|
| 749 |
AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD; |
| 750 |
AslGbl_CommentState.ParsingParenBraceNode = NULL; |
| 751 |
CvDbgPrint ("End Parsing paren/Brace node!\n"); |
| 752 |
break; |
| 753 |
|
| 754 |
case '}': |
| 755 |
|
| 756 |
AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE; |
| 757 |
break; |
| 758 |
|
| 759 |
case ',': |
| 760 |
|
| 761 |
AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE; |
| 762 |
break; |
| 763 |
|
| 764 |
default: |
| 765 |
|
| 766 |
AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE; |
| 767 |
break; |
| 768 |
} |
| 769 |
} |
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
void |
| 786 |
CvAddToCommentList ( |
| 787 |
char *ToAdd) |
| 788 |
{ |
| 789 |
|
| 790 |
if (AslGbl_CommentListHead) |
| 791 |
{ |
| 792 |
AslGbl_CommentListTail->Next = CvCommentNodeCalloc (); |
| 793 |
AslGbl_CommentListTail = AslGbl_CommentListTail->Next; |
| 794 |
} |
| 795 |
else |
| 796 |
{ |
| 797 |
AslGbl_CommentListHead = CvCommentNodeCalloc (); |
| 798 |
AslGbl_CommentListTail = AslGbl_CommentListHead; |
| 799 |
} |
| 800 |
|
| 801 |
AslGbl_CommentListTail->Comment = ToAdd; |
| 802 |
} |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
char * |
| 819 |
CvAppendInlineComment ( |
| 820 |
char *InlineComment, |
| 821 |
char *ToAdd) |
| 822 |
{ |
| 823 |
char* Str; |
| 824 |
UINT32 Size = 0; |
| 825 |
|
| 826 |
|
| 827 |
if (!InlineComment) |
| 828 |
{ |
| 829 |
return (ToAdd); |
| 830 |
} |
| 831 |
|
| 832 |
if (!ToAdd) |
| 833 |
{ |
| 834 |
return (InlineComment); |
| 835 |
} |
| 836 |
|
| 837 |
Size = strlen (ToAdd); |
| 838 |
Size += strlen (InlineComment); |
| 839 |
Str = UtLocalCacheCalloc (Size + 1); |
| 840 |
|
| 841 |
strcpy (Str, InlineComment); |
| 842 |
strcat (Str, ToAdd); |
| 843 |
Str[Size +1] = 0; |
| 844 |
return (Str); |
| 845 |
} |
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
void |
| 863 |
CvPlaceComment( |
| 864 |
UINT8 Type, |
| 865 |
char *CommentString) |
| 866 |
{ |
| 867 |
ACPI_PARSE_OBJECT *LatestParseNode; |
| 868 |
ACPI_PARSE_OBJECT *ParenBraceNode; |
| 869 |
|
| 870 |
|
| 871 |
LatestParseNode = AslGbl_CommentState.LatestParseOp; |
| 872 |
ParenBraceNode = AslGbl_CommentState.ParsingParenBraceNode; |
| 873 |
CvDbgPrint ("Placing comment %s for type %d\n", CommentString, Type); |
| 874 |
|
| 875 |
switch (Type) |
| 876 |
{ |
| 877 |
case ASL_COMMENT_STANDARD: |
| 878 |
|
| 879 |
CvAddToCommentList (CommentString); |
| 880 |
break; |
| 881 |
|
| 882 |
case ASLCOMMENT_INLINE: |
| 883 |
|
| 884 |
LatestParseNode->Asl.InlineComment = |
| 885 |
CvAppendInlineComment (LatestParseNode->Asl.InlineComment, |
| 886 |
CommentString); |
| 887 |
break; |
| 888 |
|
| 889 |
case ASL_COMMENT_OPEN_PAREN: |
| 890 |
|
| 891 |
AslGbl_InlineCommentBuffer = |
| 892 |
CvAppendInlineComment(AslGbl_InlineCommentBuffer, |
| 893 |
CommentString); |
| 894 |
break; |
| 895 |
|
| 896 |
case ASL_COMMENT_CLOSE_PAREN: |
| 897 |
|
| 898 |
if (ParenBraceNode) |
| 899 |
{ |
| 900 |
ParenBraceNode->Asl.EndNodeComment = |
| 901 |
CvAppendInlineComment (ParenBraceNode->Asl.EndNodeComment, |
| 902 |
CommentString); |
| 903 |
} |
| 904 |
else |
| 905 |
{ |
| 906 |
LatestParseNode->Asl.EndNodeComment = |
| 907 |
CvAppendInlineComment (LatestParseNode->Asl.EndNodeComment, |
| 908 |
CommentString); |
| 909 |
} |
| 910 |
break; |
| 911 |
|
| 912 |
case ASL_COMMENT_CLOSE_BRACE: |
| 913 |
|
| 914 |
LatestParseNode->Asl.CloseBraceComment = CommentString; |
| 915 |
break; |
| 916 |
|
| 917 |
default: |
| 918 |
|
| 919 |
break; |
| 920 |
} |
| 921 |
} |