Exemplo n.º 1
0
 @Override
 public void setPragmaOnceSemantics(boolean value) throws CoreException {
   Database db = fLinkage.getDB();
   byte flags = db.getByte(record + FLAGS);
   if (value) {
     flags |= FLAG_PRAGMA_ONCE_SEMANTICS;
   } else {
     flags &= ~FLAG_PRAGMA_ONCE_SEMANTICS;
   }
   db.putByte(record + FLAGS, flags);
 }
Exemplo n.º 2
0
  /**
   * Transfers names, macros and includes from another file to this one and deletes the other file.
   *
   * @param sourceFile the file to transfer the local bindings from.
   * @throws CoreException
   */
  public void replaceContentsFrom(PDOMFile sourceFile) throws CoreException {
    // Delete current content
    clear();

    // Link in the using directives
    setLastUsingDirective(sourceFile.getLastUsingDirectiveRec());

    // Link in the includes, replace the owner.
    PDOMInclude include = sourceFile.getFirstInclude();
    setFirstInclude(include);
    for (; include != null; include = include.getNextInIncludes()) {
      include.setIncludedBy(this);
    }

    // In the unexpected case that there is an included by relation, append it.
    transferIncluders(sourceFile);

    // Link in the macros.
    PDOMMacro macro = sourceFile.getFirstMacro();
    setFirstMacro(macro);
    for (; macro != null; macro = macro.getNextMacro()) {
      macro.setFile(this);
    }

    // Link in macro references
    PDOMMacroReferenceName mref = sourceFile.getFirstMacroReference();
    setFirstMacroReference(mref);
    for (; mref != null; mref = mref.getNextInFile()) {
      mref.setFile(this);
    }

    // Replace all the names in this file
    PDOMName name = sourceFile.getFirstName();
    setFirstName(name);
    for (; name != null; name = name.getNextInFile()) {
      name.setFile(this);
    }

    setTimestamp(sourceFile.getTimestamp());
    setSourceReadTime(sourceFile.getSourceReadTime());
    setSizeAndEncodingHashcode(sourceFile.getSizeAndEncodingHashcode());
    setContentsHash(sourceFile.getContentsHash());

    // Transfer the flags.
    Database db = fLinkage.getDB();
    db.putByte(record + FLAGS, db.getByte(sourceFile.record + FLAGS));

    // Transfer the replacement header.
    db.putRecPtr(record + REPLACEMENT_HEADER, db.getRecPtr(sourceFile.record + REPLACEMENT_HEADER));
    db.putRecPtr(sourceFile.record + REPLACEMENT_HEADER, 0);

    // Delete the source file
    sourceFile.delete();
  }
Exemplo n.º 3
0
 @Override
 public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point)
     throws CoreException {
   if (newBinding instanceof IVariable) {
     final Database db = getDB();
     ICPPVariable var = (ICPPVariable) newBinding;
     IType newType = var.getType();
     setType(linkage, newType);
     setValue(var.getInitialValue());
     db.putByte(record + ANNOTATIONS, PDOMCPPAnnotations.encodeVariableAnnotations(var));
   }
 }
Exemplo n.º 4
0
  public PDOMCPPVariable(
      PDOMLinkage linkage, PDOMNode parent, ICPPVariable variable, boolean setTypeAndValue)
      throws CoreException {
    super(linkage, parent, variable.getNameCharArray());

    // Find the type record
    Database db = getDB();
    db.putByte(record + ANNOTATIONS, PDOMCPPAnnotations.encodeVariableAnnotations(variable));
    if (setTypeAndValue) {
      setType(parent.getLinkage(), variable.getType());
      setValue(variable.getInitialValue());
    }
  }
  private void storeProperties(ICPPEnumeration enumeration) throws CoreException {
    final Database db = getDB();
    db.putByte(record + OFFSET_FLAGS, enumeration.isScoped() ? (byte) 1 : (byte) 0);

    getLinkage().storeType(record + OFFSET_FIXED_TYPE, enumeration.getFixedType());

    if (enumeration instanceof ICPPInternalBinding) {
      if (((ICPPInternalBinding) enumeration).getDefinition() != null) {
        final long minValue = enumeration.getMinValue();
        final long maxValue = enumeration.getMaxValue();
        db.putLong(record + OFFSET_MIN_VALUE, minValue);
        db.putLong(record + OFFSET_MAX_VALUE, maxValue);
        fMinValue = minValue;
        fMaxValue = maxValue;
      }
    }
  }
Exemplo n.º 6
0
 private void storeAnnotations(Database db, ICPPParameter param) throws CoreException {
   byte annotations = PDOMCPPAnnotations.encodeVariableAnnotations(param);
   db.putByte(record + ANNOTATIONS, annotations);
 }