/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-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* *18***********************************************************************/19#ifndef _VCDELTA_H20#define _VCDELTA_H 12122/* Types and functions related to delta compression as defined by23** the IETF RFC3284 Proposed Standard.24**25** Written by Kiem-Phong Vo26*/2728/* bits in the delta indicator byte */29#define VCD_DATACOMPRESS (1<<0) /* compressed unmatched data */30#define VCD_INSTCOMPRESS (1<<1) /* compressed instructions */31#define VCD_ADDRCOMPRESS (1<<2) /* compressed COPY addrs */3233/* delta instruction types */34#define VCD_NOOP 035#define VCD_ADD 1 /* data immediately follow */36#define VCD_RUN 2 /* a run of a single byte */37#define VCD_COPY 3 /* copy data from some earlier address */38#define VCD_BYTE 4 /* Vcinst_t.mode is the byte encoded */3940/* Address modes are limited to 16 (VCD_ADDR). Of these, VCD_SELF41and VCD_HERE are reserved. The remaining modes are s+n < 16 where42s*256 is the size of "same address" cache and n is the size of the43"near address" cache.44*/45#define VCD_ADDR 16 /* the maximum number of address modes */46#define VCD_SELF 0 /* COPY addr is coded as itself */47#define VCD_HERE 1 /* COPY addr is offset from current pos */4849/* buffer size requirement for encoding/decoding code tables */50#define VCD_TBLSIZE (6*256 + 64)5152typedef struct _vcdinst_s Vcdinst_t; /* instruction type */53typedef struct _vcdcode_s Vcdcode_t; /* a pair of insts */54typedef struct _vcdtable_s Vcdtable_t; /* entire code table */5556struct _vcdinst_s57{ Vcchar_t type; /* COPY, RUN, ADD, NOOP, BYTE */58Vcchar_t size; /* if 0, size coded separately */59Vcchar_t mode; /* address mode for COPY */60};6162struct _vcdcode_s63{ Vcdinst_t inst1;64Vcdinst_t inst2;65};6667struct _vcdtable_s68{ Vcchar_t s_near; /* size of near address cache */69Vcchar_t s_same; /* size of same address cache */70Vcdcode_t code[256]; /* codes -> instructions */71};7273_BEGIN_EXTERNS_7475#if _BLD_vcodex && defined(__EXPORT__)76#define extern __EXPORT__77#endif7879extern ssize_t vcdputtable _ARG_((Vcdtable_t*, Void_t*, size_t));80extern int vcdgettable _ARG_((Vcdtable_t*, Void_t*, size_t));8182#undef extern8384_END_EXTERNS_8586#endif /*_VCDELTA_H*/878889