/*
* 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.
*/
// Global Structures
struct jar;
struct gunzip;
struct band;
struct cpool;
struct entry;
struct cpindex;
struct inner_class;
struct value_stream;
struct cpindex {
}
}
};
struct cpool {
// Position and size of each homogeneous subrange:
// Well-known Utf8 symbols.
enum {
};
// read counts from hdr, allocate main arrays
// pointer to outer unpacker, for error checks etc.
unpacker* u;
}
}
void expandSignatures();
void initMemberIndexes();
void computeOutputOrder();
void computeOutputIndexes();
void resetOutputIndexes();
// error handling
inline bool aborting();
};
/*
* The unpacker provides the entry points to the unpack engine,
* as well as maintains the state of the engine.
*/
struct unpacker {
// One element of the resulting JAR.
struct file {
const char* name;
int modtime;
int options;
// Note: If Sum(data[*].len) < size,
// remaining bytes must be read directly from the input stream.
};
// back pointer to NativeUnpacker obj and Java environment
void* jniobj;
void* jnienv;
// global pointer to self, if not running under JNI (not multi-thread safe)
// if running Unix-style, here are the inputs and outputs
#ifndef PRODUCT
int nowrite;
int skipfiles;
int verbose_bands;
#endif
// pointer to self, for U_NEW macro
unpacker* u;
// private abort message string, allocated to PATH_MAX*2
const char* abort_message;
// option management members
bool strip_compile;
bool strip_debug;
bool strip_jcov;
bool remove_packfile;
const char* errstrm_name;
const char* log_file;
// input stream
int unsized_bytes_read;
// callback to read at least one byte, up to available input
// archive header fields
int band_headers_size;
// engine state
// output stream
// output state
bool cur_class_has_local_ics;
// stats pertaining to multiple segments (updated on reset)
// attribute state
struct layout_definition {
};
struct attr_definitions {
unpacker* u; // pointer to self, for U_NEW macro
void free() {
strip_names.free();
band_stack.free();
}
// Locate the five fixed bands.
band& xxx_flags_hi();
band& xxx_flags_lo();
band& xxx_attr_count();
band& xxx_attr_indexes();
band& xxx_attr_calls();
// Register a new layout, and make bands for it.
// Parse a layout string or part of one, recursively if necessary.
bool can_be_signed = false);
// Read data into the bands of the idx-th layout.
}
void setHaveLongFlags(bool z) {
}
bool haveLongFlags() {
return flag_limit == X_ATTR_LIMIT_FLAGS_HI;
}
// Return flag_count if idx is predef and not redef, else zero.
if (idx >= flag_limit) return false;
}
if (idx >= flag_limit) return false;
}
}
if (idx < flag_limit)
else
}
if (idx < flag_limit)
return flag_count[idx];
else
}
};
// Initialization
// Resets to a known sane state
void reset();
// Deallocates all storage.
void free();
// Deallocates temporary storage (volatile after next client call).
// Option management methods
const char* get_option(const char* option);
void dump_options();
// Fetching input.
// Entry points to the unpack engine
void check_options();
void redirect_stdio();
void write_file_to_jar(file* f);
void finish();
// Public post unpack methods
// General purpose methods
#ifndef PRODUCT
#endif
const char* get_abort_message();
// Output management
}
void putu2(int n); // { putu2_at(put_space(2), n); }
void putu4(int n); // { putu4_at(put_space(4), n); }
void put_stackmap_type();
void get_code_header(int& max_stack,
int& max_na_locals,
int& handler_count,
int& cflags);
// Definitions of standard classfile int formats:
// Private stuff
void reset_cur_classfile();
void write_classfile_tail();
void write_classfile_head();
void write_code();
void write_bc_ops();
// The readers
void read_bands();
void read_file_header();
void read_cp();
void read_attr_defs();
void read_ics();
void read_classes();
void read_code_headers();
void read_bcs();
void read_bc_ops();
void read_files();
};