コード例 #1
0
 /** Creates the location definitions */
 private void createLocations() {
   ArrayList<DictionaryFileRef> files = new ArrayList<DictionaryFileRef>();
   LocationStore.startLocations();
   for (TraceGroup group : dictionaryFile.getOwner().getModel()) {
     for (Trace trace : group) {
       writeLocation(files, trace);
     }
   }
   // Build XML and assign ID's to refs
   Collections.sort(files, new FileRefComparator());
   String lastpath = null;
   for (DictionaryFileRef ref : files) {
     if (!ref.path.equals(lastpath)) {
       if (lastpath != null) {
         LocationStore.endPath();
       }
       LocationStore.startPath(ref.path);
       lastpath = ref.path;
     }
     LocationStore.writeFile(++fileref, ref.file);
     ref.refid = fileref;
   }
   if (lastpath != null) {
     LocationStore.endPath();
   }
   LocationStore.endLocations();
 }
コード例 #2
0
  /**
   * 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();
        }
      }
    }
  }
コード例 #3
0
 /** 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();
 }
コード例 #4
0
 /**
  * Builds the list of parameter types
  *
  * @return the list of types found from the model
  */
 private ArrayList<String> buildTypeList() {
   TraceModel model = dictionaryFile.getOwner().getModel();
   ArrayList<String> typeList = new ArrayList<String>();
   for (TraceGroup group : model) {
     for (Trace trace : group) {
       for (TraceParameter parameter : trace) {
         if ((parameter.getExtension(HiddenTraceObjectRule.class) == null)
             || (parameter.getExtension(FillerParameterRule.class) != null)) {
           String type = parameter.getType();
           if (!typeList.contains(type)) {
             typeList.add(type);
           }
         }
       }
     }
   }
   return typeList;
 }
コード例 #5
0
 /** 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();
 }