1*946379e7Schristos /* Compile a Java program. 2*946379e7Schristos Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. 3*946379e7Schristos Written by Bruno Haible <haible@clisp.cons.org>, 2001. 4*946379e7Schristos 5*946379e7Schristos This program is free software; you can redistribute it and/or modify 6*946379e7Schristos it under the terms of the GNU General Public License as published by 7*946379e7Schristos the Free Software Foundation; either version 2, or (at your option) 8*946379e7Schristos any later version. 9*946379e7Schristos 10*946379e7Schristos This program is distributed in the hope that it will be useful, 11*946379e7Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 12*946379e7Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*946379e7Schristos GNU General Public License for more details. 14*946379e7Schristos 15*946379e7Schristos You should have received a copy of the GNU General Public License 16*946379e7Schristos along with this program; if not, write to the Free Software Foundation, 17*946379e7Schristos Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18*946379e7Schristos 19*946379e7Schristos #ifndef _JAVACOMP_H 20*946379e7Schristos #define _JAVACOMP_H 21*946379e7Schristos 22*946379e7Schristos #include <stdbool.h> 23*946379e7Schristos 24*946379e7Schristos /* Compile a Java source file to bytecode. 25*946379e7Schristos java_sources is an array of source file names. 26*946379e7Schristos classpaths is a list of pathnames to be prepended to the CLASSPATH. 27*946379e7Schristos 28*946379e7Schristos source_version can be: support for 29*946379e7Schristos 1.3 inner classes 30*946379e7Schristos 1.4 assert keyword 31*946379e7Schristos 1.5 generic classes and methods 32*946379e7Schristos 1.6 (not yet supported) 33*946379e7Schristos target_version can be: classfile version: 34*946379e7Schristos 1.1 45.3 35*946379e7Schristos 1.2 46.0 36*946379e7Schristos 1.3 47.0 37*946379e7Schristos 1.4 48.0 38*946379e7Schristos 1.5 49.0 39*946379e7Schristos 1.6 50.0 40*946379e7Schristos target_version can also be given as NULL. In this case, the required 41*946379e7Schristos target_version is determined from the found JVM (see javaversion.h). 42*946379e7Schristos Specifying target_version is useful when building a library (.jar) that is 43*946379e7Schristos useful outside the given package. Passing target_version = NULL is useful 44*946379e7Schristos when building an application. 45*946379e7Schristos It is unreasonable to ask for: 46*946379e7Schristos - target_version < 1.4 with source_version >= 1.4, or 47*946379e7Schristos - target_version < 1.5 with source_version >= 1.5, or 48*946379e7Schristos - target_version < 1.6 with source_version >= 1.6, 49*946379e7Schristos because even Sun's javac doesn't support these combinations. 50*946379e7Schristos It is redundant to ask for a target_version > source_version, since the 51*946379e7Schristos smaller target_version = source_version will also always work and newer JVMs 52*946379e7Schristos support the older target_versions too. Except for the case 53*946379e7Schristos target_version = 1.4, source_version = 1.3, which allows gcj versions 3.0 54*946379e7Schristos to 3.2 to be used. 55*946379e7Schristos 56*946379e7Schristos directory is the target directory. The .class file for class X.Y.Z is 57*946379e7Schristos written at directory/X/Y/Z.class. If directory is NULL, the .class 58*946379e7Schristos file is written in the source's directory. 59*946379e7Schristos use_minimal_classpath = true means to ignore the user's CLASSPATH and 60*946379e7Schristos use a minimal one. This is likely to reduce possible problems if the 61*946379e7Schristos user's CLASSPATH contains garbage or a classes.zip file of the wrong 62*946379e7Schristos Java version. 63*946379e7Schristos If verbose, the command to be executed will be printed. 64*946379e7Schristos Return false if OK, true on error. */ 65*946379e7Schristos extern bool compile_java_class (const char * const *java_sources, 66*946379e7Schristos unsigned int java_sources_count, 67*946379e7Schristos const char * const *classpaths, 68*946379e7Schristos unsigned int classpaths_count, 69*946379e7Schristos const char *source_version, 70*946379e7Schristos const char *target_version, 71*946379e7Schristos const char *directory, 72*946379e7Schristos bool optimize, bool debug, 73*946379e7Schristos bool use_minimal_classpath, 74*946379e7Schristos bool verbose); 75*946379e7Schristos 76*946379e7Schristos #endif /* _JAVACOMP_H */ 77