// If we have a empty StringTable\r
//\r
if (al.size() == 0) {\r
- cDeclCode += tab + String.format("UINT16 %s[1]; /* StringTable is Empty */", stringTable) + newLine; \r
+ cDeclCode += String.format("%-20s%s[1]; /* StringTable is empty */", "UINT16", stringTable) + newLine; \r
decl = new CStructTypeDeclaration (\r
stringTable,\r
2,\r
); \r
declaList.add(decl);\r
\r
- cInstCode = " { 0 } " + String.format("/* %s */", stringTable);\r
+ cInstCode = String.format("/* %s */", stringTable) + newLine + tab + "{ 0 }";\r
instTable.put(stringTable, cInstCode);\r
} else {\r
\r
stringTableName = String.format("%s_%d", stringTable, i);\r
cDeclCode += tab;\r
}\r
- cDeclCode += String.format("UINT16 %s[%d]; /* %s */", stringTableName, str.length() + 1, alComments.get(i)) + newLine;\r
+ cDeclCode += String.format("%-20s%s[%d]; /* %s */", "UINT16", stringTableName, str.length() + 1, alComments.get(i)) + newLine;\r
\r
if (i == 0) {\r
cInstCode = "/* StringTable */" + newLine;\r
Output.add("/* SizeTable */");\r
Output.add("{");\r
if (al.size() == 0) {\r
- Output.add("0");\r
+ Output.add("\t0");\r
} else {\r
for (int index = 0; index < al.size(); index++) {\r
Integer n = al.get(index);\r
\r
guidStrArray =(uuid.toString()).split("-");\r
\r
- return String.format("{ 0x%s, 0x%s, 0x%s, { 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s } }",\r
+ return String.format("{0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",\r
guidStrArray[0],\r
guidStrArray[1],\r
guidStrArray[2],\r
Output.add("/* GuidTable */");\r
Output.add("{");\r
if (al.size() == 0) {\r
- Output.add(getUuidCString(new UUID(0, 0)));\r
+ Output.add("\t" + getUuidCString(new UUID(0, 0)));\r
}\r
\r
for (int i = 0; i < al.size(); i++) {\r
decl = new CStructTypeDeclaration (\r
"SystemSkuId",\r
1,\r
- "SKU_ID SystemSkuId;\r\n",\r
+ String.format("%-20sSystemSkuId;\r\n", "SKU_ID"),\r
true\r
);\r
declaList.add(decl);\r
output.add("{");\r
\r
if (al.size() == 0) {\r
- output.add("0");\r
+ output.add("\t0");\r
}\r
\r
for (int index = 0; index < al.size(); index++) {\r
private final String newLine = "\r\n";\r
private final String commaNewLine = ",\r\n";\r
private final String tab = "\t";\r
- public final static String ExMapTableDeclaration = "DYNAMICEX_MAPPING ExMapTable[%s_EXMAPPING_TABLE_SIZE];\r\n";\r
- public final static String GuidTableDeclaration = "EFI_GUID GuidTable[%s_GUID_TABLE_SIZE];\r\n";\r
- public final static String LocalTokenNumberTableDeclaration = "UINT32 LocalTokenNumberTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";\r
- public final static String StringTableDeclaration = "UINT16 StringTable[%s_STRING_TABLE_SIZE];\r\n";\r
- public final static String SizeTableDeclaration = "UINT16 SizeTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";\r
- public final static String SkuIdTableDeclaration = "UINT8 SkuIdTable[%s_SKUID_TABLE_SIZE];\r\n";\r
+ public final static String ExMapTableDeclaration = "DYNAMICEX_MAPPING ExMapTable[%s_EXMAPPING_TABLE_SIZE];\r\n";\r
+ public final static String GuidTableDeclaration = "EFI_GUID GuidTable[%s_GUID_TABLE_SIZE];\r\n";\r
+ public final static String LocalTokenNumberTableDeclaration = "UINT32 LocalTokenNumberTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";\r
+ public final static String StringTableDeclaration = "UINT16 StringTable[%s_STRING_TABLE_SIZE];\r\n";\r
+ public final static String SizeTableDeclaration = "UINT16 SizeTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";\r
+ public final static String SkuIdTableDeclaration = "UINT8 SkuIdTable[%s_SKUID_TABLE_SIZE];\r\n";\r
\r
\r
public final static String ExMapTableSizeMacro = "#define %s_EXMAPPING_TABLE_SIZE %d\r\n";\r
//\r
// We made a assumption that both PEI_PCD_DATABASE and DXE_PCD_DATABASE\r
// has a least one data memember with alignment size of 1. So we can\r
- // remove the last "," in the C structure instantiation string.\r
+ // remove the last "," in the C structure instantiation string. Luckily,\r
+ // this is true as both data structure has SKUID_TABLE anyway.\r
//\r
if ((align == 1) && (i == declaListBasedOnAlignment.size() - 1)) {\r
initInstStr += newLine;\r
}\r
\r
if (uinitDatabaseEmpty) {\r
- uninitDeclStr += tab + " UINT8 dummy; /* PCD_DATABASE_UNINIT is emptry */\r\n";\r
+ uninitDeclStr += tab + String.format("%-20sdummy; /* PCD_DATABASE_UNINIT is emptry */\r\n", "UINT8");\r
}\r
\r
initDeclStr += String.format("} %s_PCD_DATABASE_INIT;", phase) + newLine + newLine;\r
}\r
\r
private String getSkuEnabledTypeDeclaration (Token token) {\r
- return String.format("SKU_HEAD %s;\r\n", token.getPrimaryKeyString());\r
+ return String.format("%-20s%s;\r\n", "SKU_HEAD", token.getPrimaryKeyString());\r
}\r
\r
private String getSkuEnabledTypeInstantiaion (Token token, int SkuTableIdx) {\r
}\r
\r
if (t.isUnicodeStringType()) {\r
- privateGlobalCCode = String.format("STRING_HEAD %s[%d];\r\n", t.getPrimaryKeyString(), t.getSkuIdCount());\r
+ privateGlobalCCode = String.format("%-20s%s[%d];\r\n", "STRING_HEAD", t.getPrimaryKeyString(), t.getSkuIdCount());\r
} else {\r
String type = getCType(t);\r
if (t.datumType == Token.DATUM_TYPE.POINTER) {\r
- privateGlobalCCode = String.format("%s %s[%d][%d];\r\n", type, privateGlobalName, t.getSkuIdCount(), t.datumSize);\r
+ int bufferSize;\r
+ if (t.isASCIIStringType()) {\r
+ //\r
+ // Build tool will add a NULL string at the end of the ASCII string\r
+ //\r
+ bufferSize = t.datumSize + 1;\r
+ } else {\r
+ bufferSize = t.datumSize;\r
+ }\r
+ privateGlobalCCode = String.format("%-20s%s[%d][%d];\r\n", type, privateGlobalName, t.getSkuIdCount(), bufferSize);\r
} else {\r
- privateGlobalCCode = String.format("%s %s[%d];\r\n", type, privateGlobalName, t.getSkuIdCount());\r
+ privateGlobalCCode = String.format("%-20s%s[%d];\r\n", type, privateGlobalName, t.getSkuIdCount());\r
}\r
}\r
}\r
\r
private String getDataTypeDeclarationForVariableDefault_new (Token token, String cName, int skuId) {\r
\r
- String typeStr = "";\r
+ String typeStr;\r
\r
if (token.datumType == Token.DATUM_TYPE.UINT8) {\r
typeStr = "UINT8";\r
} else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {\r
typeStr = "BOOLEAN";\r
} else if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
- return String.format("UINT8 %s[%d]", cName, token.datumSize);\r
+ return String.format("%-20s%s[%d];\r\n", cName, token.datumSize);\r
} else {\r
+ typeStr = "";\r
}\r
\r
- return String.format("%s %s;\r\n", typeStr, cName);\r
+ return String.format("%-20s%s;\r\n", typeStr, cName);\r
}\r
\r
private String getDataTypeDeclaration (Token token) {\r