24 printf(
"intcmp a = %ld b = %ld a - b = %ld\n", a ,b , a - b);
41 long is_int(
char **s,
long *len,
long *sgn)
46 printf(
"is_int *s = %s\n",*s);
56 if ((*sgn=(*stmp==
'-'))) {
61 printf(
"is_int = FALSE\n");
69 printf(
"is_int = FALSE\n");
73 while (*stmp==
'0') stmp++;
76 if (*stmp<'0' || *stmp>
'9')
79 printf(
"is_int = FALSE\n");
88 printf(
"is_int = TRUE *len = %ld *sgn = %ld *s = %s\n",*len,*sgn,*s);
108 long len1,len2,sgn1,sgn2;
116 if(*(str1+1)==0 && *(str2+1)==0)
117 return *str1 - *str2;
123 if (
is_int(&s1,&len1,&sgn1)) {
124 if (
is_int(&s2,&len2,&sgn2)) {
125 if (sgn1!=sgn2)
return (sgn2-sgn1);
126 if (len1!=len2)
return (len1-len2);
127 return strcmp(s1,s2);
133 if (
is_int(&s2,&len2,&sgn2))
136 return strcmp(s1,s2);
154 if (s==
one || s==
two)
return s;
188 if (s==
one || s==
two)
return s;
245 cmp =
intcmp((
long)keystr,(
long) (*tree)->key);
247 cmp =
featcmp(keystr,(*tree)->key);
249 cmp = strcmp(keystr,(*tree)->key);
251 Errorline(
"Bad comp in general_insert.\n");
254 tree=(&((*tree)->left));
258 Errorline(
"attempt to overwrite an existing feature; ignored.\n");
265 tree=(&((*tree)->right));
412 cmp =
intcmp((
long)keystr,(
long) (tree)->key);
414 cmp =
featcmp(keystr,(tree)->key);
416 cmp = strcmp(keystr,(tree)->key);
418 Errorline(
"Bad comp in general_insert.\n");
533 else if ((*n)->left) {
ptr_node bk_stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
bk_stack_insert
void push_ptr_value(type_ptr t, GENERIC *p)
push_ptr_value
#define HEAP
Flag to indicate heap allocation.
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
ptr_node bk2_stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
bk2_stack_insert
#define INTCMP
indicates to use intcmp for comparison (in trees.c)
char * stack_copy_string(char *s)
stack_copy_string
ptr_node find(long comp, char *keystr, ptr_node tree)
find
void push_ptr_value_global(type_ptr t, GENERIC *p)
push_ptr_value_global
ptr_node find_data(GENERIC p, ptr_node t)
find_data
char * heap_copy_string(char *s)
heap_copy_string
void heap_insert_copystr(char *keystr, ptr_node *tree, GENERIC info)
heap_insert_copystr
char * heap_ncopy_string(char *s, int n)
heap_ncopy_string
void Errorline(char *format,...)
Errorline.
unsigned long * GENERIC
unsigned long *GENERIC
ptr_node stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
stack_insert
#define TRUE
Standard boolean.
#define STRCMP
indicates to use strcmp for comparison (c function)
#define FALSE
Standard boolean.
ptr_node heap_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
heap_insert
long intcmp(long a, long b)
intcmp
ptr_node general_insert(long comp, char *keystr, ptr_node *tree, GENERIC info, long heapflag, long copystr, long bkflag)
ptr_node general_insert
long featcmp(char *str1, char *str2)
featcmp
long is_int(char **s, long *len, long *sgn)
is_int
void delete_attr(char *s, ptr_node *n)
delete_attr
void stack_insert_copystr(char *keystr, ptr_node *tree, GENERIC info)
stack_insert_copystr
GENERIC heap_alloc(long s)
heap_alloc
GENERIC stack_alloc(long s)
stack_alloc
#define STACK
Flag to indicate stack allocation.
#define int_ptr
values of type_ptr