/** * Writes the data type definitions * * @param typeList the list of data types */ private void writeTypeDefinitions(ArrayList<String> typeList) { for (String type : typeList) { DataType dt = mapTypeToDataType(type); if (dt != null) { // Normal parameters int size = mapParameterTypeToSize(type); String formatChar = SourceUtils.mapNormalTypeToFormat(type); if (formatChar != null && formatChar.length() > 1 && formatChar.charAt(0) == '%') { formatChar = formatChar.substring(1); TypeDefStore.writeTypeDef(type, size, formatChar, dt); // Write alternative format characters writeAlternativeFormatChars(formatChar, type, size, dt); } else { TypeDefStore.writeTypeDef(type, size, null, dt); } } else { // Enum parameters TraceModel model = dictionaryFile.getOwner().getModel(); TraceConstantTable table = model.findConstantTableByName(type); if (table != null) { TypeDefStore.startTypeDef( table.getName(), mapParameterTypeToSize(table.getType()), null, DataType.ENUM); for (TraceConstantTableEntry entry : table) { TypeDef.writeTypeMember(entry.getID(), entry.getName(), null); } TypeDefStore.endTypeDef(); } } } }
/** Creates the trace definitions */ private void createDefs() { // This should check for duplicates TraceDataStore.startDataStore(); TraceModel model = dictionaryFile.getOwner().getModel(); TraceProjectAPI api = model.getExtension(TraceProjectAPI.class); for (TraceGroup group : model) { for (Trace trace : group) { trace.addExtension(new DictionaryDefRef(++defref)); TraceFormatFlags flags = new TraceFormatFlags(); flags.isFormattingSupported = true; String data = api.formatTraceForExport(trace, flags); data = replaceUnescapeQuotes(data); TraceDataStore.writeData(defref, DataType.STRING, data); } } TraceDataStore.endDataStore(); }
/** Creates the component definition */ private void createComponent() { TraceModel model = dictionaryFile.getOwner().getModel(); int compid = model.getID(); // Component prefix and suffix are in property file. // If not there, the default values are used String prefix = TraceObjectUtils.findProperty(model, PropertyNames.PREFIX); if (prefix == null || prefix.length() == 0) { prefix = FormattingUtils.getDefaultComponentPrefix(model); } String suffix = TraceObjectUtils.findProperty(model, PropertyNames.SUFFIX); if (suffix == null || suffix.length() == 0) { suffix = FormattingUtils.getDefaultComponentSuffix(model); } Dictionary.startComponent(compid, dictionaryFile.getProjectName(), prefix, suffix); for (TraceGroup group : model) { createGroup(group); } Dictionary.endComponent(); }