2 * value - definitions of general values and related routines used by calc
4 * Copyright (C) 1999-2007 David I. Bell
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.4 $
21 * @(#) $Id: value.h,v 30.4 2013/08/11 08:41:38 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/value.h,v $
24 * Under source code control: 1993/07/30 19:42:47
25 * File existed as early as: 1993
27 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
31 #if !defined(__VALUE_H__)
35 #if defined(CALC_SRC) /* if we are building from the calc source tree */
43 # include "nametype.h"
46 # include <calc/decl.h>
47 # include <calc/cmath.h>
48 # include <calc/config.h>
49 # include <calc/sha1.h>
50 # include <calc/calcerr.h>
51 # include <calc/hash.h>
52 # include <calc/block.h>
53 # include <calc/nametype.h>
54 # include <calc/str.h>
58 #define MAXDIM 4 /* maximum number of dimensions in matrices */
59 #define USUAL_ELEMENTS 4 /* usual number of elements for objects */
63 * Flags to modify results from the printvalue routine.
64 * These flags are OR'd together.
66 #define PRINT_NORMAL 0x00 /* print in normal manner */
67 #define PRINT_SHORT 0x01 /* print in short format (no elements) */
68 #define PRINT_UNAMBIG 0x02 /* print in non-ambiguous manner */
72 * Definition of values of various types.
74 typedef struct value VALUE
;
75 typedef struct object OBJECT
;
76 typedef struct matrix MATRIX
;
77 typedef struct list LIST
;
78 typedef struct assoc ASSOC
;
80 typedef struct rand RAND
;
81 typedef struct random RANDOM
;
87 * See below for information on what needs to be added for a new type.
90 short v_type
; /* type of value */
91 unsigned short v_subtype
; /* other data related to some types */
92 union { /* types of values (see V_XYZ below) */
93 long vv_int
; /* 1: small integer value */
94 NUMBER
*vv_num
; /* 2, 21: real number */
95 COMPLEX
*vv_com
; /* 3: complex number */
96 VALUE
*vv_addr
; /* 4, 18: address of variable value */
97 STRING
*vv_str
; /* 5, 20: string value */
98 MATRIX
*vv_mat
; /* 6: address of matrix */
99 LIST
*vv_list
; /* 7: address of list */
100 ASSOC
*vv_assoc
; /* 8: address of association */
101 OBJECT
*vv_obj
; /* 9: address of object */
102 FILEID vv_file
; /* 10: id of opened file */
103 RAND
*vv_rand
; /* 11: additive 55 random state */
104 RANDOM
*vv_random
; /* 12: Blum random state */
105 CONFIG
*vv_config
; /* 13: configuration state */
106 HASH
*vv_hash
; /* 14: hash state */
107 BLOCK
*vv_block
; /* 15: memory block */
108 OCTET
*vv_octet
; /* 16, 19: octet addr (unsigned char) */
109 NBLOCK
*vv_nblock
; /* 17: named memory block */
115 * For ease in referencing
117 #define v_int v_union.vv_int
118 #define v_file v_union.vv_file
119 #define v_num v_union.vv_num
120 #define v_com v_union.vv_com
121 #define v_addr v_union.vv_addr
122 #define v_str v_union.vv_str
123 #define v_mat v_union.vv_mat
124 #define v_list v_union.vv_list
125 #define v_assoc v_union.vv_assoc
126 #define v_obj v_union.vv_obj
127 #define v_valid v_union.vv_int
128 #define v_rand v_union.vv_rand
129 #define v_random v_union.vv_random
130 #define v_config v_union.vv_config
131 #define v_hash v_union.vv_hash
132 #define v_block v_union.vv_block
133 #define v_octet v_union.vv_octet
134 #define v_nblock v_union.vv_nblock
140 * NOTE: The following files should be checked/adjusted for a new type:
142 * size.c - elm_count(), lsizeof()
143 * help/size - update what the size() builtin will report
144 * hash.c - hash_value()
145 * quickhash.c - hashvalue()
146 * value.c - freevalue(), copyvalue(), comparevalue(),
148 * and other as needed such as testvalue(), etc.
150 * There may be others, but at is at least a start.
152 #define V_NULL 0 /* null value */
153 #define V_INT 1 /* normal integer */
154 #define V_NUM 2 /* number */
155 #define V_COM 3 /* complex number */
156 #define V_ADDR 4 /* address of variable value */
157 #define V_STR 5 /* address of string */
158 #define V_MAT 6 /* address of matrix structure */
159 #define V_LIST 7 /* address of list structure */
160 #define V_ASSOC 8 /* address of association structure */
161 #define V_OBJ 9 /* address of object structure */
162 #define V_FILE 10 /* opened file id */
163 #define V_RAND 11 /* address of additive 55 random state */
164 #define V_RANDOM 12 /* address of Blum random state */
165 #define V_CONFIG 13 /* configuration state */
166 #define V_HASH 14 /* hash state */
167 #define V_BLOCK 15 /* memory block */
168 #define V_OCTET 16 /* octet (unsigned char) */
169 #define V_NBLOCK 17 /* named memory block */
170 #define V_VPTR 18 /* value address as pointer */
171 #define V_OPTR 19 /* octet address as pointer */
172 #define V_SPTR 20 /* string address as pointer */
173 #define V_NPTR 21 /* number address as pointer */
174 #define V_MAX 21 /* highest legal value */
176 #define V_NOSUBTYPE 0 /* subtype has no meaning */
177 #define V_NOASSIGNTO 1 /* protection status 1 */
178 #define V_NONEWVALUE 2 /* protection status 2 */
179 #define V_NONEWTYPE 4 /* protection status 4 */
180 #define V_NOERROR 8 /* protection status 8 */
181 #define V_NOCOPYTO 16 /* protection status 16 */
182 #define V_NOREALLOC 32 /* protection status 32 */
183 #define V_NOASSIGNFROM 64 /* protection status 64 */
184 #define V_NOCOPYFROM 128 /* protection status 128 */
185 #define V_PROTECTALL 256 /* protection status 256 */
187 #define MAXPROTECT 511
190 * At present protect(var, sts) determines bits in var->v_subtype
191 * corresponding to 4 * sts. MAXPROTECT is the sum of the simple
192 * (power of two) protection status values.
196 #define TWOVAL(a,b) ((a) << 5 | (b)) /* for switch of two values */
198 #define NULL_VALUE ((VALUE *) 0)
204 E_FUNC
void freevalue(VALUE
*vp
);
205 E_FUNC
void copyvalue(VALUE
*vp
, VALUE
*vres
);
206 E_FUNC
void negvalue(VALUE
*vp
, VALUE
*vres
);
207 E_FUNC
void addvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
208 E_FUNC
void subvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
209 E_FUNC
void mulvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
210 E_FUNC
void orvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
211 E_FUNC
void andvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
212 E_FUNC
void compvalue(VALUE
*vp
, VALUE
*vres
);
213 E_FUNC
void xorvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
214 E_FUNC
void squarevalue(VALUE
*vp
, VALUE
*vres
);
215 E_FUNC
void invertvalue(VALUE
*vp
, VALUE
*vres
);
216 E_FUNC
void roundvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
217 E_FUNC
void broundvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
218 E_FUNC
void setminusvalue(VALUE
*, VALUE
*, VALUE
*);
219 E_FUNC
void backslashvalue(VALUE
*, VALUE
*);
220 E_FUNC
void contentvalue(VALUE
*, VALUE
*);
221 E_FUNC
void hashopvalue(VALUE
*, VALUE
*, VALUE
*);
222 E_FUNC
void apprvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
223 E_FUNC
void intvalue(VALUE
*vp
, VALUE
*vres
);
224 E_FUNC
void fracvalue(VALUE
*vp
, VALUE
*vres
);
225 E_FUNC
void incvalue(VALUE
*vp
, VALUE
*vres
);
226 E_FUNC
void decvalue(VALUE
*vp
, VALUE
*vres
);
227 E_FUNC
void conjvalue(VALUE
*vp
, VALUE
*vres
);
228 E_FUNC
void sqrtvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
229 E_FUNC
void rootvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
230 E_FUNC
void absvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
231 E_FUNC
void normvalue(VALUE
*vp
, VALUE
*vres
);
232 E_FUNC
void shiftvalue(VALUE
*v1
, VALUE
*v2
, BOOL rightshift
, VALUE
*vres
);
233 E_FUNC
void scalevalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
234 E_FUNC
void powvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
235 E_FUNC
void powervalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
236 E_FUNC
void divvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
237 E_FUNC
void quovalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
238 E_FUNC
void modvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*v3
, VALUE
*vres
);
239 E_FUNC BOOL
testvalue(VALUE
*vp
);
240 E_FUNC BOOL
comparevalue(VALUE
*v1
, VALUE
*v2
);
241 E_FUNC BOOL
acceptvalue(VALUE
*v1
, VALUE
*v2
);
242 E_FUNC
void relvalue(VALUE
*v1
, VALUE
*v2
, VALUE
*vres
);
243 E_FUNC
void sgnvalue(VALUE
*vp
, VALUE
*vres
);
244 E_FUNC QCKHASH
hashvalue(VALUE
*vp
, QCKHASH val
);
245 E_FUNC
void printvalue(VALUE
*vp
, int flags
);
246 E_FUNC
void printestr(VALUE
*vp
);
247 E_FUNC BOOL
precvalue(VALUE
*v1
, VALUE
*v2
);
248 E_FUNC VALUE
error_value(int e
);
249 E_FUNC
int set_errno(int e
);
250 E_FUNC
int set_errcount(int e
);
251 E_FUNC
long countlistitems(LIST
*lp
);
252 E_FUNC
void addlistitems(LIST
*lp
, VALUE
*vres
);
253 E_FUNC
void addlistinv(LIST
*lp
, VALUE
*vres
);
254 E_FUNC
void copy2octet(VALUE
*, OCTET
*);
255 E_FUNC
int copystod(VALUE
*, long, long, VALUE
*, long);
256 E_FUNC
void protecttodepth(VALUE
*, int, int);
257 E_FUNC
void set_update(int);
261 * Structure of a matrix.
264 long m_dim
; /* dimension of matrix */
265 long m_size
; /* total number of elements */
266 long m_min
[MAXDIM
]; /* minimum bound for indices */
267 long m_max
[MAXDIM
]; /* maximum bound for indices */
268 VALUE m_table
[1]; /* actually varying length table */
271 #define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE)))
274 E_FUNC MATRIX
*matadd(MATRIX
*m1
, MATRIX
*m2
);
275 E_FUNC MATRIX
*matsub(MATRIX
*m1
, MATRIX
*m2
);
276 E_FUNC MATRIX
*matmul(MATRIX
*m1
, MATRIX
*m2
);
277 E_FUNC MATRIX
*matneg(MATRIX
*m
);
278 E_FUNC MATRIX
*matalloc(long size
);
279 E_FUNC MATRIX
*matcopy(MATRIX
*m
);
280 E_FUNC MATRIX
*matinit(MATRIX
*m
, VALUE
*v1
, VALUE
*v2
);
281 E_FUNC MATRIX
*matsquare(MATRIX
*m
);
282 E_FUNC MATRIX
*matinv(MATRIX
*m
);
283 E_FUNC MATRIX
*matscale(MATRIX
*m
, long n
);
284 E_FUNC MATRIX
*matshift(MATRIX
*m
, long n
);
285 E_FUNC MATRIX
*matmulval(MATRIX
*m
, VALUE
*vp
);
286 E_FUNC MATRIX
*matpowi(MATRIX
*m
, NUMBER
*q
);
287 E_FUNC MATRIX
*matconj(MATRIX
*m
);
288 E_FUNC MATRIX
*matquoval(MATRIX
*m
, VALUE
*vp
, VALUE
*v3
);
289 E_FUNC MATRIX
*matmodval(MATRIX
*m
, VALUE
*vp
, VALUE
*v3
);
290 E_FUNC MATRIX
*matint(MATRIX
*m
);
291 E_FUNC MATRIX
*matfrac(MATRIX
*m
);
292 E_FUNC MATRIX
*matappr(MATRIX
*m
, VALUE
*v2
, VALUE
*v3
);
293 E_FUNC VALUE
mattrace(MATRIX
*m
);
294 E_FUNC MATRIX
*mattrans(MATRIX
*m
);
295 E_FUNC MATRIX
*matcross(MATRIX
*m1
, MATRIX
*m2
);
296 E_FUNC BOOL
mattest(MATRIX
*m
);
297 E_FUNC
void matsum(MATRIX
*m
, VALUE
*vres
);
298 E_FUNC BOOL
matcmp(MATRIX
*m1
, MATRIX
*m2
);
299 E_FUNC
int matsearch(MATRIX
*m
, VALUE
*vp
, long start
, long end
, ZVALUE
*index
);
300 E_FUNC
int matrsearch(MATRIX
*m
, VALUE
*vp
, long start
, long end
,
302 E_FUNC VALUE
matdet(MATRIX
*m
);
303 E_FUNC VALUE
matdot(MATRIX
*m1
, MATRIX
*m2
);
304 E_FUNC
void matfill(MATRIX
*m
, VALUE
*v1
, VALUE
*v2
);
305 E_FUNC
void matfree(MATRIX
*m
);
306 E_FUNC
void matprint(MATRIX
*m
, long max_print
);
307 E_FUNC VALUE
*matindex(MATRIX
*mp
, BOOL create
, long dim
, VALUE
*indices
);
308 E_FUNC
void matreverse(MATRIX
*m
);
309 E_FUNC
void matsort(MATRIX
*m
);
310 E_FUNC BOOL
matisident(MATRIX
*m
);
311 E_FUNC MATRIX
*matround(MATRIX
*m
, VALUE
*v2
, VALUE
*v3
);
312 E_FUNC MATRIX
*matbround(MATRIX
*m
, VALUE
*v2
, VALUE
*v3
);
317 * An individual list element.
319 typedef struct listelem LISTELEM
;
321 LISTELEM
*e_next
; /* next element in list (or NULL) */
322 LISTELEM
*e_prev
; /* previous element in list (or NULL) */
323 VALUE e_value
; /* value of this element */
328 * Structure for a list of elements.
331 LISTELEM
*l_first
; /* first list element (or NULL) */
332 LISTELEM
*l_last
; /* last list element (or NULL) */
333 LISTELEM
*l_cache
; /* cached list element (or NULL) */
334 long l_cacheindex
; /* index of cached element (or undefined) */
335 long l_count
; /* total number of elements in the list */
339 E_FUNC
void insertlistfirst(LIST
*lp
, VALUE
*vp
);
340 E_FUNC
void insertlistlast(LIST
*lp
, VALUE
*vp
);
341 E_FUNC
void insertlistmiddle(LIST
*lp
, long index
, VALUE
*vp
);
342 E_FUNC
void removelistfirst(LIST
*lp
, VALUE
*vp
);
343 E_FUNC
void removelistlast(LIST
*lp
, VALUE
*vp
);
344 E_FUNC
void removelistmiddle(LIST
*lp
, long index
, VALUE
*vp
);
345 E_FUNC
void listfree(LIST
*lp
);
346 E_FUNC
void listprint(LIST
*lp
, long max_print
);
347 E_FUNC
int listsearch(LIST
*lp
, VALUE
*vp
, long start
, long end
, ZVALUE
*index
);
348 E_FUNC
int listrsearch(LIST
*lp
, VALUE
*vp
, long start
, long end
,
350 E_FUNC BOOL
listcmp(LIST
*lp1
, LIST
*lp2
);
351 E_FUNC VALUE
*listfindex(LIST
*lp
, long index
);
352 E_FUNC LIST
*listalloc(void);
353 E_FUNC LIST
*listcopy(LIST
*lp
);
354 E_FUNC
void listreverse(LIST
*lp
);
355 E_FUNC
void listsort(LIST
*lp
);
356 E_FUNC LIST
*listappr(LIST
*lp
, VALUE
*v2
, VALUE
*v3
);
357 E_FUNC LIST
*listround(LIST
*m
, VALUE
*v2
, VALUE
*v3
);
358 E_FUNC LIST
*listbround(LIST
*m
, VALUE
*v2
, VALUE
*v3
);
359 E_FUNC LIST
*listquo(LIST
*lp
, VALUE
*v2
, VALUE
*v3
);
360 E_FUNC LIST
*listmod(LIST
*lp
, VALUE
*v2
, VALUE
*v3
);
361 E_FUNC BOOL
evp(LISTELEM
*cp
, LISTELEM
*x
, VALUE
*vres
);
362 E_FUNC BOOL
evalpoly(LIST
*clist
, LISTELEM
*x
, VALUE
*vres
);
363 E_FUNC
void insertitems(LIST
*lp1
, LIST
*lp2
);
364 E_FUNC LISTELEM
*listelement(LIST
*, long);
365 E_FUNC LIST
*listsegment(LIST
*, long, long);
369 * Structures for associations.
370 * Associations are "indexed" by one or more arbitrary values, and are
371 * stored in a hash table with their hash values for quick indexing.
373 typedef struct assocelem ASSOCELEM
;
375 ASSOCELEM
*e_next
; /* next element in list (or NULL) */
376 long e_dim
; /* dimension of indexing for this element */
377 QCKHASH e_hash
; /* hash value for this element */
378 VALUE e_value
; /* value of association */
379 VALUE e_indices
[1]; /* index values (variable length) */
384 long a_count
; /* number of elements in the association */
385 long a_size
; /* current size of association hash table */
386 ASSOCELEM
**a_table
; /* current hash table for elements */
390 E_FUNC ASSOC
*assocalloc(long initsize
);
391 E_FUNC ASSOC
*assoccopy(ASSOC
*ap
);
392 E_FUNC
void assocfree(ASSOC
*ap
);
393 E_FUNC
void assocprint(ASSOC
*ap
, long max_print
);
394 E_FUNC
int assocsearch(ASSOC
*ap
, VALUE
*vp
, long start
, long end
,
396 E_FUNC
int assocrsearch(ASSOC
*ap
, VALUE
*vp
, long start
, long end
,
398 E_FUNC BOOL
assoccmp(ASSOC
*ap1
, ASSOC
*ap2
);
399 E_FUNC VALUE
*assocfindex(ASSOC
*ap
, long index
);
400 E_FUNC VALUE
*associndex(ASSOC
*ap
, BOOL create
, long dim
, VALUE
*indices
);
406 #define OBJ_PRINT 0 /* print the value */
407 #define OBJ_ONE 1 /* create the multiplicative identity */
408 #define OBJ_TEST 2 /* test a value for "zero" */
409 #define OBJ_ADD 3 /* add two values */
410 #define OBJ_SUB 4 /* subtrace one value from another */
411 #define OBJ_NEG 5 /* negate a value */
412 #define OBJ_MUL 6 /* multiply two values */
413 #define OBJ_DIV 7 /* divide one value by another */
414 #define OBJ_INV 8 /* invert a value */
415 #define OBJ_ABS 9 /* take absolute value of value */
416 #define OBJ_NORM 10 /* take the norm of a value */
417 #define OBJ_CONJ 11 /* take the conjugate of a value */
418 #define OBJ_POW 12 /* take the power function */
419 #define OBJ_SGN 13 /* return the sign of a value */
420 #define OBJ_CMP 14 /* compare two values for equality */
421 #define OBJ_REL 15 /* compare two values for inequality */
422 #define OBJ_QUO 16 /* integer quotient of values */
423 #define OBJ_MOD 17 /* remainder of division of values */
424 #define OBJ_INT 18 /* integer part of */
425 #define OBJ_FRAC 19 /* fractional part of */
426 #define OBJ_INC 20 /* increment by one */
427 #define OBJ_DEC 21 /* decrement by one */
428 #define OBJ_SQUARE 22 /* square value */
429 #define OBJ_SCALE 23 /* scale by power of two */
430 #define OBJ_SHIFT 24 /* shift left (or right) by number of bits */
431 #define OBJ_ROUND 25 /* round to specified decimal places */
432 #define OBJ_BROUND 26 /* round to specified binary places */
433 #define OBJ_ROOT 27 /* take nth root of value */
434 #define OBJ_SQRT 28 /* take square root of value */
435 #define OBJ_OR 29 /* take bitwise or of values */
436 #define OBJ_AND 30 /* take bitwise and of values */
437 #define OBJ_NOT 31 /* take logical not of value */
438 #define OBJ_FACT 32 /* factorial or postfix ! */
439 #define OBJ_MIN 33 /* minimum value */
440 #define OBJ_MAX 34 /* maximum value */
441 #define OBJ_SUM 35 /* sum value */
442 #define OBJ_ASSIGN 36 /* assign value */
443 #define OBJ_XOR 37 /* ~ difference of values */
444 #define OBJ_COMP 38 /* ~ complement of value */
445 #define OBJ_CONTENT 39 /* unary hash op */
446 #define OBJ_HASHOP 40 /* binary hash op */
447 #define OBJ_BACKSLASH 41 /* unary backslash op */
448 #define OBJ_SETMINUS 42 /* binary backslash op */
449 #define OBJ_PLUS 43 /* unary + op */
450 #define OBJ_MAXFUNC 43 /* highest function */
454 * Definition of an object type.
455 * This is actually a varying sized structure.
458 int oa_index
; /* index of object type */
459 int oa_count
; /* number of elements defined */
460 long oa_indices
[OBJ_MAXFUNC
+1]; /* function indices for actions */
461 int oa_elements
[1]; /* element indices (MUST BE LAST) */
464 #define objectactionsize(elements) \
465 (sizeof(OBJECTACTIONS) + ((elements) - 1) * sizeof(int))
469 * Structure of an object.
470 * This is actually a varying sized structure.
471 * However, there are always at least USUAL_ELEMENTS values in the object.
474 OBJECTACTIONS
*o_actions
; /* action table for this object */
475 VALUE o_table
[USUAL_ELEMENTS
]; /* object values (MUST BE LAST) */
478 #define objectsize(elements) \
479 (sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE))
482 E_FUNC OBJECT
*objcopy(OBJECT
*op
);
483 E_FUNC OBJECT
*objalloc(long index
);
484 E_FUNC VALUE
objcall(int action
, VALUE
*v1
, VALUE
*v2
, VALUE
*v3
);
485 E_FUNC
void objfree(OBJECT
*op
);
486 E_FUNC
int addelement(char *name
);
487 E_FUNC
int defineobject(char *name
, int indices
[], int count
);
488 E_FUNC
int checkobject(char *name
);
489 E_FUNC
void showobjfuncs(void);
490 E_FUNC
void showobjtypes(void);
491 E_FUNC
int findelement(char *name
);
492 E_FUNC
char *objtypename(unsigned long index
);
493 E_FUNC
int objoffset(OBJECT
*op
, long index
);
497 * Configuration parameter name and type.
499 EXTERN NAMETYPE configs
[];
500 E_FUNC
void config_value(CONFIG
*cfg
, int type
, VALUE
*ret
);
501 E_FUNC
void setconfig(int type
, VALUE
*vp
);
502 E_FUNC
void config_print(CONFIG
*cfg
); /* the CONFIG to print */
506 * size, memsize and sizeof support
508 E_FUNC
long elm_count(VALUE
*vp
);
509 E_FUNC
size_t lsizeof(VALUE
*vp
);
510 E_FUNC
size_t memsize(VALUE
*vp
);
515 E_FUNC STRING
*stringadd(STRING
*, STRING
*);
516 E_FUNC STRING
*stringcopy(STRING
*);
517 E_FUNC STRING
*stringsub(STRING
*, STRING
*);
518 E_FUNC STRING
*stringmul(NUMBER
*, STRING
*);
519 E_FUNC STRING
*stringand(STRING
*, STRING
*);
520 E_FUNC STRING
*stringor(STRING
*, STRING
*);
521 E_FUNC STRING
*stringxor(STRING
*, STRING
*);
522 E_FUNC STRING
*stringdiff(STRING
*, STRING
*);
523 E_FUNC STRING
*stringsegment(STRING
*, long, long);
524 E_FUNC STRING
*stringshift(STRING
*, long);
525 E_FUNC STRING
*stringcomp(STRING
*);
526 E_FUNC STRING
*stringneg(STRING
*);
527 E_FUNC STRING
*stringcpy(STRING
*, STRING
*);
528 E_FUNC STRING
*stringncpy(STRING
*, STRING
*, size_t);
529 E_FUNC
long stringcontent(STRING
*s
);
530 E_FUNC
long stringlowbit(STRING
*s
);
531 E_FUNC
long stringhighbit(STRING
*s
);
532 E_FUNC BOOL
stringcmp(STRING
*, STRING
*);
533 E_FUNC BOOL
stringrel(STRING
*, STRING
*);
534 E_FUNC
int stringbit(STRING
*, long);
535 E_FUNC BOOL
stringtest(STRING
*);
536 E_FUNC
int stringsetbit(STRING
*, long, BOOL
);
537 E_FUNC
int stringsearch(STRING
*, STRING
*, long, long, ZVALUE
*);
538 E_FUNC
int stringrsearch(STRING
*, STRING
*, long, long, ZVALUE
*);
540 #endif /* !__VALUE_H__ */