Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
leb128.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 
00037 #ifndef _CMPLRS_LEB128_H
00038 #define _CMPLRS_LEB128_H
00039 /*
00040 
00041         LEB128.H
00042 
00043         reading and writing leb128 numbers.
00044         See the DWARF documentation for further information on leb numbers.
00045         No error indication is returned.
00046 
00047         The supplied buffer must be long enough to hold the leb number.
00048         For encode, 5 bytes is sufficient for 32 bit values and 10 bytes
00049         is sufficient for 64 bit values.
00050 
00051         The value returned is the number of bytes in the leb encoding.
00052 
00053         For improperly coded leb number (or one having more than
00054         the allowed number of leb digits with the most significant
00055         bit on in the input buffer) the
00056         leb buffer decode scan stops at 5 characters for 32 bit decodes 
00057         and stops at 10 characters for 64 bit decodes.  
00058         For such numbers the returned length will be 5  or 10 
00059         respectively, and no error indication is supplied.
00060         
00061         These routines are in libelfutil.a
00062 
00063 */
00064  
00065 
00066 
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070 
00071 #ifndef __GNUC__
00072 
00073 extern int _leb128_unsigned_encode64(__uint64_t /*number*/, char* /*buffer*/);
00074 extern int _leb128_signed_encode64(__int64_t /*number*/, char* /*buffer*/);
00075 
00076 extern int _leb128_unsigned_encode32(__uint32_t /*number*/, char* /*buffer*/);
00077 extern int _leb128_signed_encode32(__int32_t /*number*/, char* /*buffer*/);
00078 
00079 extern int _leb128_unsigned_decode64(char* /*data*/, __uint64_t* /*value*/);
00080 extern int _leb128_signed_decode64(char* /*data*/, __int64_t* /*value*/);
00081 
00082 extern int _leb128_unsigned_decode32(char* /*data*/, __uint32_t* /*value*/);
00083 extern int _leb128_signed_decode32(char* /*data*/, __int32_t* /*value*/);
00084 
00085 #else
00086 
00087 #include <sys/types.h>
00088 
00089 extern int _leb128_unsigned_encode64(u_int64_t /*number*/, char* /*buffer*/);
00090 extern int _leb128_signed_encode64(int64_t /*number*/, char* /*buffer*/);
00091 
00092 extern int _leb128_unsigned_encode32(u_int32_t /*number*/, char* /*buffer*/);
00093 extern int _leb128_signed_encode32(int32_t /*number*/, char* /*buffer*/);
00094 
00095 extern int _leb128_unsigned_decode64(char* /*data*/, u_int64_t* /*value*/);
00096 extern int _leb128_signed_decode64(char* /*data*/, int64_t* /*value*/);
00097 
00098 extern int _leb128_unsigned_decode32(char* /*data*/, u_int32_t* /*value*/);
00099 extern int _leb128_signed_decode32(char* /*data*/, int32_t* /*value*/);
00100 
00101 #endif
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines