/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
class SDE {
/* for C capatibility */
private class FileTableRecord {
int fileId;
boolean isConverted = false;
/**
* Return the sourcePath, computing it if not set.
* If set, convert '/' in the sourcePath to the
* local file separator.
*/
if (!isConverted) {
if (sourcePath == null) {
} else {
if (ch == '/') {
} else {
}
}
}
isConverted = true;
}
return sourcePath;
}
}
private class LineTableRecord {
int jplsStart;
int jplsEnd;
int jplsLineInc;
int njplsStart;
int njplsEnd;
int fileId;
}
private class StratumTableRecord {
int fileIndex;
int lineIndex;
}
class Stratum {
}
}
boolean isJava() {
return sti == baseStratumIndex;
}
/**
* Return all the sourceNames for this stratum.
* Look from our starting fileIndex upto the starting
* fileIndex of next stratum - can do this since there
* is always a terminator stratum.
* Default sourceName (the first one) must be first.
*/
int i;
/* one past end */
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
}
return result;
}
/**
* Return all the sourcePaths for this stratum.
* Look from our starting fileIndex upto the starting
* fileIndex of next stratum - can do this since there
* is always a terminator stratum.
* Default sourcePath (the first one) must be first.
*/
int i;
/* one past end */
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
}
return result;
}
int jplsLine) {
if (lti < 0) {
return null;
} else {
jplsLine);
}
}
}
class LineStratum {
private final int jplsLine;
int jplsLine) {
}
} else {
return false;
}
}
int lineNumber() {
}
/**
* Fetch the source name and source path for
* this line, converting or constructing
* the source path if needed.
*/
void getSourceInfo() {
if (sourceName != null) {
// already done
return;
}
if (fti == -1) {
throw new InternalError(
"Bad SourceDebugExtension, no matching source id " +
}
}
return sourceName;
}
return sourcePath;
}
}
boolean isValid = false;
decode();
}
SDE() {
this.sourceDebugExtension = null;
}
char sdePeek() {
syntax();
}
}
char sdeRead() {
syntax();
}
}
void sdeAdvance() {
sdePos++;
}
void syntax() {
throw new InternalError("bad SourceDebugExtension syntax - position " +
sdePos);
}
}
void assureLineTableSize() {
int i;
for (i = 0; i < len; ++i) {
}
for (; i < newLen; ++i) {
newTable[i] = new LineTableRecord();
}
}
}
void assureFileTableSize() {
int i;
for (i = 0; i < len; ++i) {
}
for (; i < newLen; ++i) {
newTable[i] = new FileTableRecord();
}
}
}
void assureStratumTableSize() {
if (stratumIndex >= len) {
int i;
for (i = 0; i < len; ++i) {
newTable[i] = stratumTable[i];
}
for (; i < newLen; ++i) {
newTable[i] = new StratumTableRecord();
}
}
}
char ch;
ignoreWhite();
}
// check for CR LF
sdeRead();
}
ignoreWhite(); // leading white
}
private int defaultStratumTableIndex() {
}
return defaultStratumIndex;
}
int i;
return defaultStratumTableIndex();
}
return i;
}
}
return defaultStratumTableIndex();
}
}
}
return strata;
}
/*****************************
*
* Needed support functions:
* sdePeek()
* sdeRead()
* sdeAdvance()
* readLine()
* assureLineTableSize()
* assureFileTableSize()
* assureStratumTableSize()
* syntax()
*
* stratumTableIndex(String)
*
* Needed support variables:
* lineTable
* lineIndex
* fileTable
* fileIndex
* currentFileId
*
* Needed types:
* String
*
* Needed constants:
* NullString
*/
void ignoreWhite() {
char ch;
sdeAdvance();
}
}
void ignoreLine() {
char ch;
}
/* check for CR LF */
sdeAdvance();
}
ignoreWhite(); /* leading white */
}
int readNumber() {
int value = 0;
char ch;
ignoreWhite();
sdeAdvance();
}
ignoreWhite();
return value;
}
++fileIndex;
}
void fileLine() {
int fileId;
/* is there an absolute filename? */
if (sdePeek() == '+') {
sdeAdvance();
hasAbsolute = 1;
}
fileId = readNumber();
sourceName = readLine();
if (hasAbsolute == 1) {
sourcePath = readLine();
}
}
++lineIndex;
}
/**
* Parse line translation info. Syntax is
* <NJ-start-line> [ # <file-id> ] [ , <line-count> ] :
* <J-start-line> [ , <line-increment> ] CR
*/
void lineLine() {
int lineCount = 1;
int lineIncrement = 1;
int njplsStart;
int jplsStart;
njplsStart = readNumber();
/* is there a fileID? */
if (sdePeek() == '#') {
sdeAdvance();
currentFileId = readNumber();
}
/* is there a line count? */
if (sdePeek() == ',') {
sdeAdvance();
lineCount = readNumber();
}
if (sdeRead() != ':') {
syntax();
}
jplsStart = readNumber();
if (sdePeek() == ',') {
sdeAdvance();
lineIncrement = readNumber();
}
ignoreLine(); /* flush the rest */
}
/**
* Until the next stratum section, everything after this
* is in stratumId - so, store the current indicies.
*/
/* remove redundant strata */
if (stratumIndex > 0) {
== fileIndex) &&
== lineIndex)) {
/* nothing changed overwrite it */
--stratumIndex;
}
}
/* store the results */
++stratumIndex;
currentFileId = 0;
}
/**
* The beginning of a stratum's info
*/
void stratumSection() {
storeStratum(readLine());
}
void fileSection() {
ignoreLine();
while (sdePeek() != '*') {
fileLine();
}
}
void lineSection() {
ignoreLine();
while (sdePeek() != '*') {
lineLine();
}
}
/**
* Ignore a section we don't know about.
*/
void ignoreSection() {
ignoreLine();
while (sdePeek() != '*') {
ignoreLine();
}
}
/**
* A base "Java" stratum is always available, though
* it is not in the SourceDebugExtension.
* Create the base stratum.
*/
void createJavaStratum() {
/* JPL line numbers cannot exceed 65535 */
}
/**
* Decode a SourceDebugExtension which is in SourceMap format.
* This is the entry point into the recursive descent parser.
*/
void decode() {
/* check for "SMAP" - allow EOF if not ours */
(sdeRead() != 'S') ||
(sdeRead() != 'M') ||
(sdeRead() != 'A') ||
(sdeRead() != 'P')) {
return; /* not our info */
}
ignoreLine(); /* flush the rest */
jplsFilename = readLine();
defaultStratumId = readLine();
while (true) {
if (sdeRead() != '*') {
syntax();
}
switch (sdeRead()) {
case 'S':
break;
case 'F':
fileSection();
break;
case 'L':
lineSection();
break;
case 'E':
/* set end points */
storeStratum("*terminator*");
isValid = true;
return;
default:
}
}
}
void createProxyForAbsentSDE() {
jplsFilename = null;
storeStratum("*terminator*");
}
/***************** query functions ***********************/
int i;
int lineIndexStart;
int lineIndexEnd;
/* one past end */
for (i = lineIndexStart; i < lineIndexEnd; ++i) {
return i;
}
}
return -1;
}
}
int i;
/* one past end */
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
return i;
}
}
return -1;
}
}
boolean isValid() {
return isValid;
}
}