669 |
RETURN(3,object,small_fixnum(-1),(RV(sLnil),RV(sLnil))); |
RETURN(3,object,small_fixnum(-1),(RV(sLnil),RV(sLnil))); |
670 |
} |
} |
671 |
|
|
672 |
|
DEFUN_NEW("NEXT-HASH-TABLE-INDEX",object,fSnext_hash_table_index,SI,2,2,NONE,OO,OO,OO,OO,(object table,object ind),"For HASH-TABLE and for index I return the index of the next valid entry, or -1.") { |
673 |
|
|
674 |
|
fixnum i = fix(ind); |
675 |
|
|
676 |
|
check_type_hash_table(&table); |
677 |
|
if ( i < 0) |
678 |
|
FEerror("needs non negative index",0); |
679 |
|
|
680 |
|
while ( i < table->ht.ht_size) { |
681 |
|
if (table->ht.ht_self[i].hte_key != OBJNULL) |
682 |
|
return make_fixnum(i); |
683 |
|
i++;} |
684 |
|
|
685 |
|
return small_fixnum(-1); |
686 |
|
|
687 |
|
} |
688 |
|
|
689 |
|
DEFUN_NEW("HASH-ENTRY-BY-INDEX",object,fShash_entry_by_index,SI,2,2,NONE,OO,OO,OO,OO,(object table,object ind),"For HASH-TABLE and for index I return the index of the next valid entry, or -1.") { |
690 |
|
|
691 |
|
fixnum i = fix(ind); |
692 |
|
|
693 |
|
check_type_hash_table(&table); |
694 |
|
if ( i < 0) |
695 |
|
FEerror("needs non negative index",0); |
696 |
|
if (table->ht.ht_self[i].hte_key == OBJNULL) |
697 |
|
FEerror("invalid index",0); |
698 |
|
return table->ht.ht_self[i].hte_value; |
699 |
|
|
700 |
|
} |
701 |
|
|
702 |
|
DEFUN_NEW("HASH-KEY-BY-INDEX",object,fShash_key_by_index,SI,2,2,NONE,OO,OO,OO,OO,(object table,object ind),"For HASH-TABLE and for index I return the index of the next valid key, or -1.") { |
703 |
|
|
704 |
|
fixnum i = fix(ind); |
705 |
|
|
706 |
|
check_type_hash_table(&table); |
707 |
|
if ( i < 0) |
708 |
|
FEerror("needs non negative index",0); |
709 |
|
if (table->ht.ht_self[i].hte_key == OBJNULL) |
710 |
|
FEerror("invalid index",0); |
711 |
|
return table->ht.ht_self[i].hte_key; |
712 |
|
|
713 |
|
} |
714 |
|
|
715 |
DEFUN_NEW("HASH-TABLE-TEST",object,fLhash_table_test,LISP,1,1,NONE,OO,OO,OO,OO,(object table), |
DEFUN_NEW("HASH-TABLE-TEST",object,fLhash_table_test,LISP,1,1,NONE,OO,OO,OO,OO,(object table), |
716 |
"Given a HASH-TABLE return a symbol which specifies the function used in its test") |
"Given a HASH-TABLE return a symbol which specifies the function used in its test") |
717 |
{ |
{ |