Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. function.c
  5. Abstract:
  6. Functions which are OpCode specific
  7. Author:
  8. Stephane Plante
  9. Environment:
  10. Any
  11. Revision History:
  12. --*/
  13. #include "pch.h"
  14. NTSTATUS
  15. FunctionField(
  16. IN PSTACK *Stack
  17. )
  18. /*++
  19. Routine Description:
  20. This function is the handler for the AML term 'IfElse'
  21. Arguments:
  22. Stack - The stack for the current thread
  23. Return Value:
  24. NTSTATUS
  25. --*/
  26. {
  27. NTSTATUS status;
  28. PUNASM_SCOPE localScope;
  29. PUNASM_SCOPE rootScope;
  30. UCHAR action;
  31. ASSERT( Stack != NULL && *Stack != NULL );
  32. //
  33. //
  34. // Step 1: Push a new scope
  35. //
  36. status = ParsePush( Stack );
  37. if (!NT_SUCCESS( status )) {
  38. return status;
  39. }
  40. //
  41. // Step 2: Find the current scopes
  42. //
  43. ScopeFindLocalScope( Stack, &localScope, &rootScope, status );
  44. //
  45. // Step 3: Program the parameters for the new scope
  46. //
  47. localScope->IndentLevel += 2;
  48. //
  49. // Step 4: Remember to pop this scope
  50. //
  51. action = SC_PARSE_POP;
  52. StringStackPush( &(rootScope->ParseStack), 1, &action );
  53. //
  54. // Step 5: Schedule a call to the field handler
  55. //
  56. action = SC_PARSE_FIELD;
  57. StringStackPush( &(rootScope->ParseStack), 1, &action );
  58. //
  59. // Step 6:
  60. //
  61. return STATUS_SUCCESS;
  62. }
  63. NTSTATUS
  64. FunctionScope(
  65. IN PSTACK *Stack
  66. )
  67. /*++
  68. Routine Description:
  69. This function is the handler for the AML Term 'Scope'
  70. Arguments:
  71. Stack - The stack for the current thread
  72. Return Value:
  73. NTSTATUS
  74. --*/
  75. {
  76. NTSTATUS status;
  77. PUNASM_SCOPE localScope;
  78. PUNASM_SCOPE rootScope;
  79. UCHAR action;
  80. ASSERT( Stack != NULL && *Stack != NULL);
  81. //
  82. // Step 1: Push a new scope
  83. //
  84. status = ParsePush( Stack );
  85. if (!NT_SUCCESS( status )) {
  86. return status;
  87. }
  88. //
  89. // Step 2: Find the current scopes
  90. //
  91. ScopeFindLocalScope( Stack, &localScope, &rootScope, status );
  92. //
  93. // Step 3: Program the parameters for the new scope
  94. //
  95. localScope->IndentLevel += 2;
  96. //
  97. // Step 4: Remember to pop this scope
  98. //
  99. action = SC_PARSE_POP;
  100. StringStackPush( &(rootScope->ParseStack), 1, &action );
  101. //
  102. // Step 5: Next action is to parse an opcode...
  103. //
  104. action = SC_PARSE_OPCODE;
  105. StringStackPush( &(rootScope->ParseStack), 1, &action );
  106. //
  107. // Step 6: Done
  108. //
  109. return STATUS_SUCCESS;
  110. }
  111. NTSTATUS
  112. FunctionTest(
  113. IN PSTACK *Stack
  114. )
  115. /*++
  116. Routine Description:
  117. This function is the handler for the AML Term 'Scope'
  118. Arguments:
  119. Stack - The stack for the current thread
  120. Return Value:
  121. NTSTATUS
  122. --*/
  123. {
  124. return FunctionScope( Stack );
  125. }