/*
* 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.
*/
/**
* An abstraction for generating support files required by native methods.
* Subclasses are for specific native interfaces. At the time of its
* original writing, this interface is rich enough to support JNI and the
* old 1.0-style native method interface.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*
* @author Sucheta Dambalkar(Revised)
*/
public abstract class Gen {
}
/*
* List of classes for which we must generate output.
*/
static private final boolean isWindows =
/**
* Override this abstract method, generating content for the named
* class into the outputstream.
*/
/**
* Override this method to provide a list of #include statements
* required by the native interface.
*/
/*
* Output location.
*/
fileManager = fm;
}
}
}
}
/*
* Smartness with generated files.
*/
protected boolean force = false;
}
/**
* We explicitly need to write ASCII files because that is what C
* compilers understand.
*/
try {
} catch (UnsupportedEncodingException use) {
return null; /* dead code */
}
}
/**
* After initializing state of an instance, use this method to start
* processing.
*
* Buffer size chosen as an approximation from a single sampling of:
* expr `du -sk` / `ls *.h | wc -l`
*/
int i = 0;
/* Everything goes to one big file... */
for (TypeElement t: classes) {
}
} else {
/* Each class goes to its own file... */
for (TypeElement t: classes) {
}
}
}
/*
* Write the contents of byte[] b to a file named file. Writing
* is done if either the file doesn't exist or if the contents are
* different.
*/
boolean mustWrite = false;
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (mustWrite) {
}
}
try {
int offset = 0;
int n;
offset += n;
}
} finally {
}
}
value = f.getConstantValue();
/* covers byte, short, int */
// Visual C++ supports the i64 suffix, not LL.
if (isWindows)
else
/* bug for bug */
else
/* bug for bug */
if (Double.isInfinite(d))
else
}
if (constString != null) {
return s.toString();
}
}
}
return null;
}
/*
* Deal with the C pre-processor.
*/
}
}
"#define _Included_" + cname;
}
return "#endif";
}
/*
* File name and file preamble related operations.
*/
getIncludes());
}
}
}
return ".h";
}
/**
* Including super classes' fields.
*/
while (true) {
if (c == null)
break;
cd = c;
}
while (!s.empty()) {
}
return fields;
}
// c.f. MethodDoc.signature
for (VariableElement p: e.getParameters()) {
sep = ",";
}
}
}