00001 /* 00002 Libraries for fields, doubly-linked lists and red-black trees. 00003 Copyright (C) 2001 James S. Plank 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 --------------------------------------------------------------------------- 00020 Please see http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Libfdr/ 00021 for instruction on how to use this library. 00022 00023 Jim Plank 00024 plank@cs.utk.edu 00025 http://www.cs.utk.edu/~plank 00026 00027 Associate Professor 00028 Department of Computer Science 00029 University of Tennessee 00030 203 Claxton Complex 00031 1122 Volunteer Blvd. 00032 Knoxville, TN 37996-3450 00033 00034 865-974-4397 00035 Fax: 865-974-4404 00036 */ 00037 #ifndef _JVAL_H_ 00038 #define _JVAL_H_ 00039 00040 /* The Jval -- a type that can hold any 8-byte type */ 00041 00042 typedef union { 00043 int i; 00044 long l; 00045 float f; 00046 double d; 00047 void *v; 00048 char *s; 00049 char c; 00050 unsigned char uc; 00051 short sh; 00052 unsigned short ush; 00053 unsigned int ui; 00054 int iarray[2]; 00055 float farray[2]; 00056 char carray[8]; 00057 unsigned char ucarray[8]; 00058 } Jval; 00059 00060 extern Jval new_jval_i(int); 00061 extern Jval new_jval_l(long); 00062 extern Jval new_jval_f(float); 00063 extern Jval new_jval_d(double); 00064 extern Jval new_jval_v(/* void */); 00065 extern Jval new_jval_s(char *); 00066 extern Jval new_jval_c(char); 00067 extern Jval new_jval_uc(unsigned char); 00068 extern Jval new_jval_sh(short); 00069 extern Jval new_jval_ush(unsigned short); 00070 extern Jval new_jval_ui(unsigned int); 00071 extern Jval new_jval_iarray(int, int); 00072 extern Jval new_jval_farray(float, float); 00073 extern Jval new_jval_carray_nt(char *); /* Carray is null terminated */ 00074 extern Jval new_jval_carray_nnt(char *); /* Carray is not null terminated */ 00075 /* For ucarray -- use carray, because it uses memcpy */ 00076 00077 extern Jval JNULL; 00078 00079 extern int jval_i(Jval); 00080 extern long jval_l(Jval); 00081 extern float jval_f(Jval); 00082 extern double jval_d(Jval); 00083 extern void *jval_v(Jval); 00084 extern char *jval_s(Jval); 00085 extern char jval_c(Jval); 00086 extern unsigned char jval_uc(Jval); 00087 extern short jval_sh(Jval); 00088 extern unsigned short jval_ush(Jval); 00089 extern unsigned int jval_ui(Jval); 00090 extern int *jval_iarray(Jval); 00091 extern float *jval_farray(Jval); 00092 extern char *jval_carray(Jval); 00093 00094 #endif