Root/qpkg/jval.h

Source at commit 2787a45c436c35fc6fd0ed452903ad045fe9571d created 8 years 10 months ago.
By Werner Almesberger, qpkg: added James S. Plank's red-black trees
1/*
2Libraries for fields, doubly-linked lists and red-black trees.
3Copyright (C) 2001 James S. Plank
4
5This library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Lesser General Public
7License as published by the Free Software Foundation; either
8version 2.1 of the License, or (at your option) any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public
16License along with this library; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19---------------------------------------------------------------------------
20Please see http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Libfdr/
21for instruction on how to use this library.
22
23Jim Plank
24plank@cs.utk.edu
25http://www.cs.utk.edu/~plank
26
27Associate Professor
28Department of Computer Science
29University of Tennessee
30203 Claxton Complex
311122 Volunteer Blvd.
32Knoxville, TN 37996-3450
33
34     865-974-4397
35Fax: 865-974-4404
36 */
37#ifndef _JVAL_H_
38#define _JVAL_H_
39
40/* The Jval -- a type that can hold any 8-byte type */
41
42typedef union {
43    int i;
44    long l;
45    float f;
46    double d;
47    void *v;
48    char *s;
49    char c;
50    unsigned char uc;
51    short sh;
52    unsigned short ush;
53    unsigned int ui;
54    int iarray[2];
55    float farray[2];
56    char carray[8];
57    unsigned char ucarray[8];
58  } Jval;
59
60extern Jval new_jval_i(int);
61extern Jval new_jval_l(long);
62extern Jval new_jval_f(float);
63extern Jval new_jval_d(double);
64extern Jval new_jval_v(void *);
65extern Jval new_jval_s(char *);
66extern Jval new_jval_c(char);
67extern Jval new_jval_uc(unsigned char);
68extern Jval new_jval_sh(short);
69extern Jval new_jval_ush(unsigned short);
70extern Jval new_jval_ui(unsigned int);
71extern Jval new_jval_iarray(int, int);
72extern Jval new_jval_farray(float, float);
73extern Jval new_jval_carray_nt(char *); /* Carray is null terminated */
74extern Jval new_jval_carray_nnt(char *); /* Carray is not null terminated */
75       /* For ucarray -- use carray, because it uses memcpy */
76
77extern Jval JNULL;
78
79extern int jval_i(Jval);
80extern long jval_l(Jval);
81extern float jval_f(Jval);
82extern double jval_d(Jval);
83extern void *jval_v(Jval);
84extern char *jval_s(Jval);
85extern char jval_c(Jval);
86extern unsigned char jval_uc(Jval);
87extern short jval_sh(Jval);
88extern unsigned short jval_ush(Jval);
89extern unsigned int jval_ui(Jval);
90extern int *jval_iarray(Jval);
91extern float *jval_farray(Jval);
92extern char *jval_carray(Jval);
93
94#endif
95

Archive Download this file

Branches:
master



interactive