/*-------------------------------------------------------------------+
|                                                                    |
|                Copyright (c) 1996, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                      S A S / C   S A M P L E                       |
|         Name: P2UPSKH                                              |
|     Language: C                                                    |
|      Purpose: Library includes, various defines, and prototypes    |
|               static skiplist functions.                           |
|                                                                    |
|   For Sample: prefix.SAMPLE.C(P2UPSK)                              |
|                                                                    |
+-------------------------------------------------------------------*/
#ifndef __P2UPSKH__
#define __P2UPSKH__
#include <stdlib.h>
#include <stdio.h>
#include <lclib.h>
#include <string.h>
#include <setjmp.h>
#undef NDEBUG

#include <assert.h>

#include "p2upnode.h"       /* Skiplist element struct NODE and      */
                            /* struct PDS_MBR.                       */

/*--------------------------------------------------------------------+
| Misc defines                                                        |
+--------------------------------------------------------------------*/
#define MAXLEVEL 16
#define PARTITION 4
#define SEED    650

#define CONTINUE             0
#define TERMINATE           -1
#define EQUAL                0
#define LESSTHAN            -1
#define GREATERTHAN          1
#define FOUND                1   /* search element found            */
#define NOT_FOUND            0   /* search element not found        */
#define YES                  1
#define NO                   0

#define ERR_COMPARE_RC     3002  /* compare function return code not */
                                 /* -1, 1, or 0.                     */

extern jmp_buf out_of_memory;

/*--------------------------------------------------------------------+
| Compare function prototype                                          |
+--------------------------------------------------------------------*/
extern int (*COMP_FP)(PDS_MBR *, PDS_MBR *);

/*--------------------------------------------------------------------+
| Internal function prototypes                                        |
+--------------------------------------------------------------------*/
static NODE * newnode( int, PDS_MBR * );
static int    randomlevel(void);
static int    slrandom(unsigned int );
#endif /* __P2UPSKH__ */