home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d6xx / d663 / unixutils.lha / UnixUtils / Source / sort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-21  |  1.2 KB  |  60 lines

  1. /**
  2.  | File: sort.h - v1.00 MLO 911226.
  3.  | See sort.c and tree.c for comments.
  4. **/
  5.  
  6. #ifdef SIMPLE
  7. #undef BALANCED_TREE
  8. #else
  9. #define TERM_LEN      16
  10. typedef enum eSortType {
  11.   ALPHABETICAL = 1,
  12.   CASE_FOLDED,
  13.   NUMERICAL,
  14.   FIELD,
  15.   COLUMN
  16. } SortType;
  17. #endif
  18.  
  19. #define LINE_LENGTH   256
  20.  
  21. #define BREAK_DETECTED  0x1
  22. #define WARNING_PRINTED 0x2
  23.  
  24. #ifdef BALANCED_TREE
  25.  
  26.   typedef struct sNode {
  27.     struct sNode *left;         /* Left branch */
  28.     struct sNode *right;        /* Right branch */
  29.     short int balance;          /* Binary tree balance factor */
  30.     short int count;            /* Number of occurrences */
  31.     char line[1];               /* Input line */
  32.   } Node;
  33.  
  34. #else
  35.  
  36.   typedef struct sNode {
  37.     struct sNode *left;
  38.     struct sNode *right;
  39.     short int count;
  40.     char line[1];
  41.   } Node;
  42.  
  43. #endif
  44.  
  45. #ifdef BALANCED_TREE
  46. void BalanceTree(char *key);
  47. #endif
  48.  
  49. #ifndef SIMPLE
  50. int   Compare(char *p1, char *p2);
  51. void  GetTokBlk(char *string, int i, char *token);
  52. void  GetTokDel(char *string, char *delim, int i, char *token);
  53. #endif
  54.  
  55. void  CheckBreak(Boolean exitprog);
  56. int   CXBRK(void);
  57. void  FreeTree(Node *pN);
  58. Node *InsertTree(char *buffer, Node *pN);
  59. void  PrintTree(Node *pN);
  60.