unpack.h revision 0
325N/A * Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Sun designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Sun in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 325N/A * CA 95054 USA or visit www.sun.com if you need additional information or 325N/A byte ixTag;
// type of entries (!= CONSTANT_None), plus 64 if sub-index 325N/A // Position and size of each homogeneous subrange: 325N/A // Well-known Utf8 symbols. 325N/A // read counts from hdr, allocate main arrays 325N/A // pointer to outer unpacker, for error checks etc. 325N/A * The unpacker provides the entry points to the unpack engine, 325N/A * as well as maintains the state of the engine. 325N/A // One element of the resulting JAR. 325N/A // Note: If Sum(data[*].len) < size, 325N/A // remaining bytes must be read directly from the input stream. 325N/A // back pointer to NativeUnpacker obj and Java environment 325N/A // global pointer to self, if not running under JNI (not multi-thread safe) 325N/A // if running Unix-style, here are the inputs and outputs 325N/A // pointer to self, for U_NEW macro 325N/A // private abort message string, allocated to PATH_MAX*2 325N/A // option management members 325N/A byte*
rp;
// read pointer (< rplimit <= input.limit()) 325N/A // callback to read at least one byte, up to available input 325N/A // archive header fields 325N/A byte*
wp;
// write pointer (< wplimit == output.limit()) // stats pertaining to multiple segments (updated on reset) uint idx;
// index (0..31...) which identifies this layout const char*
name;
// name of layout const char*
layout;
// string of layout (not yet parsed) band**
elems;
// array of top-level layout elems (or callables) unpacker* u;
// pointer to self, for U_NEW macro int attrc;
// ATTR_CONTEXT_CLASS, etc. julong redef;
// mask of local flag definitions or redefinitions // Locate the five fixed bands. // Register a new layout, and make bands for it. // Parse a layout string or part of one, recursively if necessary. // Read data into the bands of the idx-th layout. // Return flag_count if idx is predef and not redef, else zero. // Resets to a known sane state // Deallocates all storage. // Deallocates temporary storage (volatile after next client call). // Option management methods // Entry points to the unpack engine static int run(
int argc,
char **
argv);
// Unix-style entry point. // Public post unpack methods // General purpose methods // These take an implicit parameter of wp/wplimit, and resize as necessary: void putu2(
int n);
// { putu2_at(put_space(2), n); } void putu4(
int n);
// { putu4_at(put_space(4), n); } void putu8(
jlong n);
// { putu8_at(put_space(8), n); } void putref(
entry* e);
// { putu2_at(put_space(2), putref_index(e, 2)); } void putu1ref(
entry* e);
// { putu1_at(put_space(1), putref_index(e, 1)); } // Definitions of standard classfile int formats: