1) Added prototype of constructor and destructor in the library's AutoGen.h. This...
authorjwang36 <jwang36@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 19 Jan 2007 06:25:21 +0000 (06:25 +0000)
committerjwang36 <jwang36@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 19 Jan 2007 06:25:21 +0000 (06:25 +0000)
2) Corrected the prototype destructor of EdkUefiRuntimeLib.

git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@2271 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c
edk2/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c
edk2/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java

index 1b11dfb..335a9b9 100644 (file)
@@ -129,7 +129,8 @@ RuntimeDriverLibConstruct (
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
-  VOID\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
   EFI_STATUS  Status;\r
index 7ef24d4..9fa1d16 100644 (file)
@@ -142,7 +142,8 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
-  VOID\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 /*++\r
 \r
index c6d0d34..8bb77af 100644 (file)
@@ -620,12 +620,15 @@ public class AutoGen {
             fileBuffer.append("\n");\r
             fileBuffer.append(this.myPcdAutogen.getHAutoGenString());\r
         }\r
-\r
+        //\r
+        // generate function prototype for constructor and destructor\r
+        // \r
+        LibConstructorToAutogenH(moduleType, fileBuffer);\r
+        LibDestructorToAutogenH(moduleType, fileBuffer);\r
         //\r
         // Append the #endif at AutoGen.h\r
         //\r
         fileBuffer.append("#endif\n");\r
-\r
         //\r
         // Save content of string buffer to AutoGen.h file.\r
         //\r
@@ -1362,6 +1365,152 @@ public class AutoGen {
         LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
     }\r
 \r
+    /**\r
+      LibConstructorToAutogenH\r
+     \r
+      This function writes library constructor declarations AutoGen.h. The library\r
+      constructor's parameter and return value depend on module type.\r
+     \r
+      @param libInstanceList\r
+                 List of library construct name.\r
+      @param moduleType\r
+                 Module type.\r
+      @param fileBuffer\r
+                 String buffer for AutoGen.c\r
+      @throws Exception\r
+    **/\r
+    void LibConstructorToAutogenH(String moduleType, StringBuffer fileBuffer) throws EdkException {\r
+        boolean isFirst = true;\r
+\r
+        //\r
+        // If not yet parse this library instance's constructor\r
+        // element,parse it.\r
+        //\r
+        String libConstructName = saq.getLibConstructorName();\r
+        if (libConstructName == null) {\r
+            return;\r
+        }\r
+\r
+        //\r
+        // The library constructor's parameter and return value depend on\r
+        // module type.\r
+        //\r
+        if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+            fileBuffer.append("RETURN_STATUS\n");\r
+            fileBuffer.append("EFIAPI\n");\r
+            fileBuffer.append(libConstructName);\r
+            fileBuffer.append(" (\n");\r
+            fileBuffer.append("  VOID\n");\r
+            fileBuffer.append("  );\n");\r
+        } else {\r
+            switch (CommonDefinition.getModuleType(moduleType)) {\r
+            case CommonDefinition.ModuleTypeBase:\r
+                fileBuffer.append("RETURN_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libConstructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  VOID\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+\r
+            case CommonDefinition.ModuleTypePeiCore:\r
+            case CommonDefinition.ModuleTypePeim:\r
+                fileBuffer.append("EFI_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libConstructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\n");\r
+                fileBuffer.append("  IN EFI_PEI_SERVICES          **PeiServices\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+\r
+            case CommonDefinition.ModuleTypeDxeCore:\r
+            case CommonDefinition.ModuleTypeDxeDriver:\r
+            case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+            case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+            case CommonDefinition.ModuleTypeDxeSalDriver:\r
+            case CommonDefinition.ModuleTypeUefiDriver:\r
+            case CommonDefinition.ModuleTypeUefiApplication:\r
+                fileBuffer.append("EFI_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libConstructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\n");\r
+                fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+      LibDestructorToAutogenH\r
+     \r
+      This function writes library destructor declarations AutoGen.h. The library\r
+      destructor's parameter and return value depend on module type.\r
+     \r
+      @param libInstanceList\r
+                 List of library destructor name.\r
+      @param moduleType\r
+                 Module type.\r
+      @param fileBuffer\r
+                 String buffer for AutoGen.c\r
+      @throws Exception\r
+    **/\r
+    void LibDestructorToAutogenH(String moduleType, StringBuffer fileBuffer) throws EdkException {\r
+        boolean isFirst = true;\r
+        String libDestructName = saq.getLibDestructorName();\r
+        if (libDestructName == null) {\r
+            return;\r
+        }\r
+\r
+        if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+            fileBuffer.append("RETURN_STATUS\n");\r
+            fileBuffer.append("EFIAPI\n");\r
+            fileBuffer.append(libDestructName);\r
+            fileBuffer.append(" (\n");\r
+            fileBuffer.append("  VOID\n");\r
+            fileBuffer.append("  );\n");\r
+        } else {\r
+            switch (CommonDefinition.getModuleType(moduleType)) {\r
+            case CommonDefinition.ModuleTypeBase:\r
+                fileBuffer.append("RETURN_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libDestructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  VOID\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+            case CommonDefinition.ModuleTypePeiCore:\r
+            case CommonDefinition.ModuleTypePeim:\r
+                fileBuffer.append("EFI_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libDestructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\n");\r
+                fileBuffer.append("  IN EFI_PEI_SERVICES          **PeiServices\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+            case CommonDefinition.ModuleTypeDxeCore:\r
+            case CommonDefinition.ModuleTypeDxeDriver:\r
+            case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+            case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+            case CommonDefinition.ModuleTypeDxeSalDriver:\r
+            case CommonDefinition.ModuleTypeUefiDriver:\r
+            case CommonDefinition.ModuleTypeUefiApplication:\r
+                fileBuffer.append("EFI_STATUS\n");\r
+                fileBuffer.append("EFIAPI\n");\r
+                fileBuffer.append(libDestructName);\r
+                fileBuffer.append(" (\n");\r
+                fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\n");\r
+                fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\n");\r
+                fileBuffer.append("  );\n");\r
+                break;\r
+            }\r
+        }\r
+    }\r
+\r
     /**\r
       LibConstructorToAutogenc\r
      \r