/[guile]/guile/guile-core/libguile/sort.c
ViewVC logotype

Diff of /guile/guile-core/libguile/sort.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by dirk, Thu Jan 10 20:52:45 2002 UTC revision 1.40 by ossau, Tue Jan 22 23:31:39 2002 UTC
# Line 86  char *alloca (); Line 86  char *alloca ();
86  #include "libguile/feature.h"  #include "libguile/feature.h"
87  #include "libguile/root.h"  #include "libguile/root.h"
88  #include "libguile/vectors.h"  #include "libguile/vectors.h"
89    #include "libguile/lang.h"
90    
91  #include "libguile/validate.h"  #include "libguile/validate.h"
92  #include "libguile/sort.h"  #include "libguile/sort.h"
# Line 457  SCM_DEFINE (scm_sorted_p, "sorted?", 2, Line 458  SCM_DEFINE (scm_sorted_p, "sorted?", 2,
458    SCM *vp;    SCM *vp;
459    cmp_fun_t cmp = scm_cmp_function (less);    cmp_fun_t cmp = scm_cmp_function (less);
460    
461    if (SCM_NULLP (items))    if (SCM_NULL_OR_NIL_P (items))
462      return SCM_BOOL_T;      return SCM_BOOL_T;
463    
464    SCM_VALIDATE_NIM (2,less);    SCM_VALIDATE_NIM (2,less);
# Line 530  SCM_DEFINE (scm_merge, "merge", 3, 0, 0, Line 531  SCM_DEFINE (scm_merge, "merge", 3, 0, 0,
531    cmp_fun_t cmp = scm_cmp_function (less);    cmp_fun_t cmp = scm_cmp_function (less);
532    SCM_VALIDATE_NIM (3,less);    SCM_VALIDATE_NIM (3,less);
533    
534    if (SCM_NULLP (alist))    if (SCM_NULL_OR_NIL_P (alist))
535      return blist;      return blist;
536    else if (SCM_NULLP (blist))    else if (SCM_NULL_OR_NIL_P (blist))
537      return alist;      return alist;
538    else    else
539      {      {
# Line 584  scm_merge_list_x (SCM alist, SCM blist, Line 585  scm_merge_list_x (SCM alist, SCM blist,
585  {  {
586    SCM build, last;    SCM build, last;
587    
588    if (SCM_NULLP (alist))    if (SCM_NULL_OR_NIL_P (alist))
589      return blist;      return blist;
590    else if (SCM_NULLP (blist))    else if (SCM_NULL_OR_NIL_P (blist))
591      return alist;      return alist;
592    else    else
593      {      {
# Line 641  SCM_DEFINE (scm_merge_x, "merge!", 3, 0, Line 642  SCM_DEFINE (scm_merge_x, "merge!", 3, 0,
642    long alen, blen;              /* list lengths */    long alen, blen;              /* list lengths */
643    
644    SCM_VALIDATE_NIM (3,less);    SCM_VALIDATE_NIM (3,less);
645    if (SCM_NULLP (alist))    if (SCM_NULL_OR_NIL_P (alist))
646      return blist;      return blist;
647    else if (SCM_NULLP (blist))    else if (SCM_NULL_OR_NIL_P (blist))
648      return alist;      return alist;
649    else    else
650      {      {
# Line 715  SCM_DEFINE (scm_sort_x, "sort!", 2, 0, 0 Line 716  SCM_DEFINE (scm_sort_x, "sort!", 2, 0, 0
716  #define FUNC_NAME s_scm_sort_x  #define FUNC_NAME s_scm_sort_x
717  {  {
718    long len;                     /* list/vector length */    long len;                     /* list/vector length */
719    if (SCM_NULLP(items))    if (SCM_NULL_OR_NIL_P (items))
720      return SCM_EOL;      return items;
721    
722    SCM_VALIDATE_NIM (2,less);    SCM_VALIDATE_NIM (2,less);
723    
# Line 748  SCM_DEFINE (scm_sort, "sort", 2, 0, 0, Line 749  SCM_DEFINE (scm_sort, "sort", 2, 0, 0,
749              "elements.  This is not a stable sort.")              "elements.  This is not a stable sort.")
750  #define FUNC_NAME s_scm_sort  #define FUNC_NAME s_scm_sort
751  {  {
752    if (SCM_NULLP(items))    if (SCM_NULL_OR_NIL_P (items))
753      return SCM_EOL;      return items;
754    
755    SCM_VALIDATE_NIM (2,less);    SCM_VALIDATE_NIM (2,less);
756    if (SCM_CONSP (items))    if (SCM_CONSP (items))
# Line 846  SCM_DEFINE (scm_stable_sort_x, "stable-s Line 847  SCM_DEFINE (scm_stable_sort_x, "stable-s
847  {  {
848    long len;                     /* list/vector length */    long len;                     /* list/vector length */
849    
850    if (SCM_NULLP (items))    if (SCM_NULL_OR_NIL_P (items))
851      return SCM_EOL;      return items;
852    
853    SCM_VALIDATE_NIM (2,less);    SCM_VALIDATE_NIM (2,less);
854    if (SCM_CONSP (items))    if (SCM_CONSP (items))
# Line 885  SCM_DEFINE (scm_stable_sort, "stable-sor Line 886  SCM_DEFINE (scm_stable_sort, "stable-sor
886  #define FUNC_NAME s_scm_stable_sort  #define FUNC_NAME s_scm_stable_sort
887  {  {
888    long len;                     /* list/vector length */    long len;                     /* list/vector length */
889    if (SCM_NULLP (items))    if (SCM_NULL_OR_NIL_P (items))
890      return SCM_EOL;      return items;
891    
892    SCM_VALIDATE_NIM (2,less);    SCM_VALIDATE_NIM (2,less);
893    if (SCM_CONSP (items))    if (SCM_CONSP (items))

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26