]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Added prototype of constructor and destructor in the library's AutoGen.h. This...
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Jan 2007 06:25:21 +0000 (06:25 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Jan 2007 06:25:21 +0000 (06:25 +0000)
2) Corrected the prototype destructor of EdkUefiRuntimeLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2271 6f19259b-4bc3-4df7-8a09-765794883524

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

index 1b11dfb5fa4a7f288f8680ba83f5005c8471a40a..335a9b9bc71fbf8338851b05b89ef72ae5c00938 100644 (file)
@@ -129,7 +129,8 @@ RuntimeDriverLibConstruct (
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
 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
   )\r
 {\r
   EFI_STATUS  Status;\r
index 7ef24d4938211f0bc7dfcfd339205b87b9d4844e..9fa1d1610d4845873024d1360eba01a4be08f4de 100644 (file)
@@ -142,7 +142,8 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
-  VOID\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 /*++\r
 \r
   )\r
 /*++\r
 \r
index c6d0d342cde2f962f8a22584bf1fc0c0e186b630..8bb77af3d1cf28e50f5dee62d3e05a33bcfbd069 100644 (file)
@@ -620,12 +620,15 @@ public class AutoGen {
             fileBuffer.append("\n");\r
             fileBuffer.append(this.myPcdAutogen.getHAutoGenString());\r
         }\r
             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
         // 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
         //\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
         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
     /**\r
       LibConstructorToAutogenc\r
      \r