/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1996-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* Glenn Fowler <[email protected]> *18* *19***********************************************************************/20#pragma prototyped2122/*23* rskey internal interface24*/2526#ifndef _RSKEYHDR_H27#define _RSKEYHDR_H 12829#if _PACKAGE_ast30#include <ast.h>31#endif3233#include <ctype.h>34#include <ccode.h>3536#ifndef UCHAR_MAX37#define UCHAR_MAX ((unsigned char)(~0))38#endif39#ifndef SHRT_MAX40#define SHRT_MAX ((short)(~((unsigned short)0)) >> 1)41#endif42#ifndef INT_MAX43#define INT_MAX ((int)(~((unsigned int)0)) >> 1)44#endif45#ifndef LONG_MAX46#define LONG_MAX ((long)(~((unsigned long)0)) >> 1)47#endif4849#define INSIZE PROCSIZE /* default insize */50#define OUTSIZE (64*1024) /* default outsize */51#define PROCSIZE (4*1024*1024) /* default procsize */5253#define MAXFIELD INT_MAX5455#define blank(c) ((c)==' '||(c)=='\t')5657typedef struct Position_s /* field position */58{59int field; /* field offset */60int index; /* char offset */61} Position_t;6263#define _RSKEYFIELD_PRIVATE_ \64unsigned char aflag; /* accumulate dups here */ \65unsigned char bflag; /* skip initial blanks */ \66unsigned char eflag; /* skip trailing blanks */ \67unsigned char standard; /* 1:-k 0:+pos-pos */ \68int binary; /* binary data */ \69int code; /* coder ccode or conversion */ \70int index; /* field definition index */ \71int freetrans; /* free trans on close */ \72unsigned char* trans; /* translation table */ \73unsigned char* keep; /* deletion table */ \74void* data; /* coder specific data */ \75Position_t begin; /* key begins here */ \76Position_t end; /* and ends here */7778typedef struct79{80unsigned char ident[UCHAR_MAX + 1]; /* identity transform */81unsigned char fold[UCHAR_MAX + 1]; /* fold case */8283unsigned char all[UCHAR_MAX + 1]; /* all significant */84unsigned char dict[UCHAR_MAX + 1]; /* dictionary order */85unsigned char print[UCHAR_MAX + 1]; /* printable significant*/86} State_t;8788#define _RSKEY_PRIVATE_ \89State_t* state; /* readonly state */ \90Rsdisc_t* disctail; /* rslib() disc stack tail */ \91struct \92{ \93Rskeyfield_t global; /* global field info */ \94Rskeyfield_t* prev; /* previous field list tail */ \95int index; /* last field index */ \96int maxfield; /* max field position */ \97unsigned char** positions; /* field start positions */ \98} field; /* key field info */ \99struct \100{ \101Rskeyfield_t* head; /* accumulate list head */ \102Rskeyfield_t* tail; /* accumulate list tail */ \103} accumulate; /* accumulate field info */ \104unsigned char* xfrmbuf; /* strxfrm buffer */ \105unsigned int xfrmsiz; /* strxfrm buffer size */ \106unsigned long shuffle; /* shuffle seed */ \107unsigned char coded; /* coded keys specified */108109#include "rshdr.h"110111#if !__STD_C && !defined(const)112#define const113#endif114115#if !_PACKAGE_ast116#if __STD_C117#include <string.h>118#endif119#define elementsof(x) (sizeof(x)/sizeof(x[0]))120#define roundof(x,y) (((x)+(y)-1)&~((y)-1))121#define streq(a,b) (*(a)==*(b)&&!strcmp(a,b))122#endif123124#endif125126127