
com.ibm.wala.shrike.sourcepos.CRTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.ibm.wala.shrike Show documentation
Show all versions of com.ibm.wala.shrike Show documentation
T. J. Watson Libraries for Analysis
The newest version!
/*
* Copyright (c) 2002 - 2014 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*/
/*
* CRTable.java
*
* Created on 10. Mai 2005, 09:05
*/
package com.ibm.wala.shrike.sourcepos;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayDeque;
/**
* This class represents the CharacterRangeTable attribute.
*
* @see CRTData
* @see CRTFlags
* @author Siegfried Weber
* @author Juergen Graf <[email protected]>
*/
public final class CRTable extends PositionsAttribute {
/** Stores the attribute name of this attribute */
public static final String ATTRIBUTE_NAME = "CharacterRangeTable";
private static final String WARN_CRT_ENTRIES_CONTRADICTORY =
"CRT entries %1$s and %2$s are contradictory.";
private static final String ERR_NO_CRT_ENTRY = "No CRT entry found for program counter %1$s.";
/** Stores the CharacterRangeTable data */
private CRTData[] crt;
/**
* Creates a new instance of CRTable.
*
* @param data the byte array containing the attribute
* @throws IOException An IOException is thrown if the attribute can't be read.
*/
public CRTable(byte[] data) throws IOException {
super(data);
if (Debug.PRINT_CHARACTER_RANGE_TABLE) {
Debug.info(this.toString());
}
}
@Override
protected void readData(DataInputStream in) throws IOException {
assert in != null;
short crt_length = in.readShort();
crt = new CRTData[crt_length];
for (int i = 0; i < crt_length; i++) {
short pc_start_index = in.readShort();
short pc_end_index = in.readShort();
int source_start_position = in.readInt();
int source_end_position = in.readInt();
short flags = in.readShort();
try {
crt[i] =
new CRTData(
pc_start_index, pc_end_index, source_start_position, source_end_position, flags);
} catch (InvalidCRTDataException e) {
ArrayDeque
© 2015 - 2025 Weber Informatics LLC | Privacy Policy