+ /**\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