/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1995-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 _VDELTA_H20#define _VDELTA_H 12122/* Header for the vdelta library23** Written by Kiem-Phong Vo ([email protected])24*/2526/* standardize conventions */27#ifndef __KPV__28#define __KPV__ 12930/* The symbol __STD_C indicates that the language is ANSI-C or C++ */31#ifndef __STD_C32#ifdef __STDC__33#define __STD_C 134#else35#if __cplusplus || c_plusplus36#define __STD_C 137#else38#define __STD_C 039#endif /*__cplusplus*/40#endif /*__STDC__*/41#endif /*__STD_C*/4243/* For C++, extern symbols must be protected against name mangling */44#ifndef _BEGIN_EXTERNS_45#if __cplusplus || c_plusplus46#define _BEGIN_EXTERNS_ extern "C" {47#define _END_EXTERNS_ }48#else49#define _BEGIN_EXTERNS_50#define _END_EXTERNS_51#endif52#endif /*_BEGIN_EXTERNS_*/5354/* _ARG_ simplifies function prototypes between K&R-C and more modern Cs */55#ifndef _ARG_56#if __STD_C57#define _ARG_(x) x58#else59#define _ARG_(x) ()60#endif61#endif /*_ARG_*/6263/* The type Void_t is properly defined so that Void_t* can address any type */64#ifndef Void_t65#if __STD_C66#define Void_t void67#else68#define Void_t char69#endif70#endif /*Void_t*/7172/* The below are for DLLs on systems such as WINDOWS that only73** allows pointers across client ** and library code.74*/75#ifndef _PTR_76#if _DLL_INDIRECT_DATA && !defined(_DLL) /* building client code */77#define _ADR_ /* cannot export whole structs - data access via ptrs */78#define _PTR_ *79#else /* library code or a normal system */80#define _ADR_ & /* exporting whole struct is ok */81#define _PTR_82#endif83#endif /*_PTR_*/8485#endif /*__KPV__*/8687/* user-supplied functions to do io */88typedef struct _vddisc_s Vddisc_t;89typedef int(* Vdio_f)_ARG_((Void_t*, int, long, Vddisc_t*));90struct _vddisc_s91{ long size; /* total data size */92Void_t* data; /* data array */93Vdio_f readf; /* to read data */94Vdio_f writef; /* to write data */95};9697/* magic header for delta output */98#define VD_MAGIC "\026\004\000\002"99#define VD_MAGIC_OLD "vd02"100101_BEGIN_EXTERNS_102extern long vddelta _ARG_((Vddisc_t*,Vddisc_t*,Vddisc_t*));103extern long vdupdate _ARG_((Vddisc_t*,Vddisc_t*,Vddisc_t*));104extern int vdsqueeze _ARG_((Void_t*, int, Void_t*));105extern int vdexpand _ARG_((Void_t*, int, Void_t*));106_END_EXTERNS_107108#endif /*_VDELTA_H*/109110111