Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

util.h

Go to the documentation of this file.
00001 #ifndef _util_h_defined_
00002 #define _util_h_defined_
00003 
00004 /*!
00005  * @file util.h
00006  *
00007  * @brief Miscellaneous utility macros and function prototypes.
00008  *
00009  * Source files whose function prototypes are defined
00010  * herein include:
00011  *
00012  *     @link jvm/src/argv.c argv.c@endlink
00013  *
00014  *     @link jvm/src/bytegames.c bytegames.c@endlink
00015  *
00016  *     @link jvm/src/classpath.c classpath.c@endlink
00017  *
00018  *     @link jvm/src/jvmutil.c jvm.c@endlink
00019  *
00020  *     @link jvm/src/manifest.c manifest.c@endlink
00021  *
00022  *     @link jvm/src/stdio.c stdio.c@endlink
00023  *
00024  *     @link jvm/src/timeslice.c timeslice.c@endlink
00025  *
00026  *     @link jvm/src/tmparea.c tmparea.c@endlink
00027  *
00028  * In order to separate the structure packing demands of
00029  * <b><code>typedef struct {} ClassFile</code></b>, the
00030  * following files will @e not have their prototypes
00031  * defined here, even though they are utility functions:
00032  * 
00033  *     @link jvm/src/nts.c nts.c@endlink
00034  *
00035  *     @link jvm/src/unicode.c unicode.c@endlink
00036  *
00037  *     @link jvm/src/utf.c utf.c@endlink
00038  *
00039  *
00040  * @section Control
00041  *
00042  * \$URL: https://svn.apache.org/path/name/util.h $ \$Id: util.h 0 09/28/2005 dlydick $
00043  *
00044  * Copyright 2005 The Apache Software Foundation
00045  * or its licensors, as applicable.
00046  *
00047  * Licensed under the Apache License, Version 2.0 ("the License");
00048  * you may not use this file except in compliance with the License.
00049  * You may obtain a copy of the License at
00050  *
00051  *     http://www.apache.org/licenses/LICENSE-2.0
00052  *
00053  * Unless required by applicable law or agreed to in writing,
00054  * software distributed under the License is distributed on an
00055  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00056  * either express or implied.
00057  *
00058  * See the License for the specific language governing permissions
00059  * and limitations under the License.
00060  *
00061  * @version \$LastChangedRevision: 0 $
00062  *
00063  * @date \$LastChangedDate: 09/28/2005 $
00064  *
00065  * @author \$LastChangedBy: dlydick $
00066  *         Original code contributed by Daniel Lydick on 09/28/2005.
00067  *
00068  * @section Reference
00069  *
00070  */
00071 
00072 ARCH_COPYRIGHT_APACHE(util, h, "$URL: https://svn.apache.org/path/name/util.h $ $Id: util.h 0 09/28/2005 dlydick $");
00073 
00074 
00075 /* Prototypes for functions in 'bytegames.c' */
00076 extern rushort bytegames_getrs2(rushort *ptr2);
00077 extern ruint   bytegames_getri4(ruint   *ptr4);
00078 extern rulong  bytegames_getrl8(rulong  *ptr8);
00079 
00080 extern rvoid   bytegames_putrs2(rushort *ptr2, rushort val2);
00081 extern rvoid   bytegames_putri4(ruint   *ptr4, ruint   val4);
00082 extern rvoid   bytegames_putrl8(rulong  *ptr8, rulong  val8);
00083 
00084 extern rushort bytegames_swap2(rushort val);
00085 extern ruint   bytegames_swap4(ruint   val);
00086 
00087 extern rulong  bytegames_swap8(rulong  val);
00088 extern rulong  bytegames_mix8(rulong   val);
00089 
00090 extern jlong   bytegames_combine_jlong(jint msword, jint lsword);
00091 extern jdouble bytegames_combine_jdouble(jint msword, jint lsword);
00092 
00093 extern rvoid bytegames_split_jlong(jlong splitlong,
00094                                    jint *msword,
00095                                    jint *lsword);
00096 extern rvoid bytegames_split_jdouble(jdouble  splitdouble,
00097                                      jint    *msword,
00098                                      jint    *lsword);
00099 /*!
00100  * @todo  Make sure GETRI4() works with -m64 compilations (64-bit ptrs)
00101  *
00102  * @todo  Make sure GETRL8() works with -m64 compilations (64-bit ptrs)
00103  *
00104  *
00105  * @internal See @link jvm/src/arch.h arch.h@endlink for the
00106  * origin of architecture-specific @c @b \#define's as used below:
00107  *
00108  */
00109 #ifdef ARCH_ODD_ADDRESS_SIGSEGV
00110 #define GETRS2(ptr) bytegames_getrs2(ptr)
00111 #define GETRI4(ptr) bytegames_getri4(ptr)
00112 #define GETRL8(ptr) bytegames_getrl8(ptr)
00113 #else
00114 #ifdef ARCH_BIG_ENDIAN
00115 #define GETRS2(ptr) (*(signed rushort *) ptr)
00116 #define GETRI4(ptr) (*(signed ruint   *) ptr)
00117 #define GETRL8(ptr) (*(signed rulong  *) ptr)
00118 #else
00119 #define GETRS2(ptr) bytegames_getrs2(ptr)
00120 #define GETRI4(ptr) bytegames_getri4(ptr)
00121 #define GETRL8(ptr) bytegames_getrl8(ptr)
00122 #endif
00123 #endif
00124 
00125 
00126 #ifdef ARCH_LITTLE_ENDIAN
00127 
00128 #define MACHINE_JSHORT_SWAP(rsval) rsval = bytegames_swap2(rsval)
00129 #define MACHINE_JINT_SWAP(rival)   rival = bytegames_swap4(rival)
00130 #define MACHINE_JLONG_SWAP(rlval)  rlval = bytegames_swap8(rlval)
00131 #define MACHINE_JLONG_MIX(rlval)   rlval = bytegames_mix8(rlval)
00132 
00133 #define MACHINE_JSHORT_SWAP_PTR(prsval) *prsval = \
00134                                              bytegames_swap2(*prsval)
00135 #define MACHINE_JINT_SWAP_PTR(prival)   *prival = \
00136                                              bytegames_swap4(*prival)
00137 #define MACHINE_JLONG_SWAP_PTR(prlval)  *prlval = \
00138                                              bytegames_swap8(*prlval)
00139 #define MACHINE_JLONG_MIX_PTR(prlval)   *prlval = \
00140                                              bytegames_mix8(*prlval)
00141 
00142 #else
00143 
00144 /*!
00145  * @internal Big endian architectures do not need to swap anything
00146  * since the JVM spec declares its (short) and (int) structures
00147  * as big endian.
00148  *
00149  */
00150 
00151 #define MACHINE_JSHORT_SWAP(p1)
00152 #define MACHINE_JINT_SWAP(p1)
00153 #define MACHINE_JLONG_SWAP(p1)
00154 #define MACHINE_JLONG_MIX(p1)
00155 
00156 #define MACHINE_JSHORT_SWAP_PTR(p1)
00157 #define MACHINE_JLONG_SWAP_PTR(p1)
00158 #define MACHINE_JLONG_MIX_PTR(p1)
00159 
00160 #endif
00161 
00162 
00163 /* Prototypes for functions in 'stdio.c' */
00164 
00165 #ifndef I_AM_STDIO_C
00166 extern rvoid sysDbgMsg(jvm_debug_level_enum dml,
00167                        rchar *fn,
00168                        rchar *fmt,
00169                        ...);
00170 extern rvoid sysErrMsg(rchar *fn, rchar *fmt, ...);
00171 extern rvoid sysErrMsgBfrFormat(rchar *bfr, rchar *fn, rchar *fmt, ...);
00172 extern rvoid sprintfLocal(rchar *bfr, rchar *fmt, ...);
00173 extern rvoid fprintfLocalStderr(rchar *fmt, ...);
00174 extern rvoid fprintfLocalStdout(rchar *fmt, ...);
00175 #endif
00176 
00177 /*!
00178  * @internal <b>DO NOT</b> (!) define prototypes for
00179  * _printfLocal() or _fprintfLocal() or _sprintfLocal().
00180  * They are meant to promote use of printfLocal() and
00181  * fprintfLocal() and sprintfLocal() instead, so let
00182  * compile warnings help.
00183  *
00184  */
00185 
00186 
00187 /* Prototypes for functions in 'argv.c' */
00188 
00189 extern rvoid argv_init(int argc, char **argv, char **envp);
00190 
00191 extern rvoid argv_shutdown(rvoid);
00192 
00193 extern rvoid argv_versionmsg(rvoid);
00194 
00195 extern rvoid argv_copyrightmsg(rvoid);
00196 
00197 extern rvoid argv_licensemsg(rvoid);
00198 
00199 extern rvoid argv_helpmsg(rvoid);
00200 
00201 extern rvoid argv_showmsg(rvoid);
00202 
00203 
00204 /* Prototypes for small utility functions in 'jvmutil.c' */
00205 
00206 extern rvoid                jvmutil_set_dml(jvm_debug_level_enum level);
00207 extern jvm_debug_level_enum jvmutil_get_dml(rvoid);
00208 
00209 extern rvoid jvmutil_print_stack(jvm_thread_index  thridx,
00210                                  rchar            *pheader);
00211 extern rvoid jvmutil_print_stack_details(jvm_thread_index  thridx,
00212                                          rchar            *pheader);
00213 extern rvoid jvmutil_print_stack_locals(jvm_thread_index  thridx,
00214                                         rchar            *pheader);
00215 extern rvoid jvmutil_print_error_stack(jvm_thread_index thridx);
00216 extern rvoid jvmutil_print_exception_stack(jvm_thread_index thridx);
00217 
00218 
00219 /* Prototypes for functions in 'manifest.c' */
00220 
00221 extern rchar *manifest_get_main(rchar *mnfname);
00222 
00223 
00224 /* Prototypes for functions in 'timeslice.c' */
00225 
00226 extern rvoid timeslice_shutdown(rvoid);
00227 extern jlong timeslice_get_thread_sleeptime(jvm_thread_index thridx);
00228 extern void *timeslice_run(void *dummy);
00229 extern rvoid timeslice_init(rvoid);
00230 
00231 
00232 /* Prototypes for functions in 'tmparea.c' */
00233 
00234 extern rvoid tmparea_init(char **argv);
00235 extern const rchar *tmparea_get(rvoid);
00236 extern rvoid tmparea_shutdown(rvoid);
00237 
00238 #endif /* _util_h_defined_ */
00239 
00240 
00241 /* EOF */
00242 

Generated on Fri Sep 30 18:49:10 2005 by  doxygen 1.4.4