All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.python.compiler.LineNumberTable Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
// Copyright 2001 Finn Bock

package org.python.compiler;

import java.util.Vector;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 * @deprecated Not used.  Delete in 2.6.
 */
@Deprecated
public class LineNumberTable {
    int attName;
    Vector lines;

    public LineNumberTable() throws IOException {
        lines = new Vector();
    }

    public void write(DataOutputStream stream) throws IOException {
        stream.writeShort(attName);
        int n = lines.size();
        stream.writeInt(n * 2 + 2);
        stream.writeShort(n / 2);
        for (int i = 0; i < n; i += 2) {
            Short startpc = lines.elementAt(i);
            Short lineno =  lines.elementAt(i+1);
            stream.writeShort(startpc.shortValue());
            stream.writeShort(lineno.shortValue());
        }
    }

    public void addLine(int startpc, int lineno) {
        lines.addElement(Short.valueOf((short) startpc));
        lines.addElement(Short.valueOf((short) lineno));
    }

    public int length() {
        return lines.size() * 2 + 8;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy