1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1995-2011 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * Phong Vo <kpv@research.att.com> * 18 * * 19 ***********************************************************************/ 20 #ifndef _VDELTA_H 21 #define _VDELTA_H 1 22 23 /* Header for the vdelta library 24 ** Written by Kiem-Phong Vo (kpv@research.att.com) 25 */ 26 27 /* standardize conventions */ 28 #ifndef __KPV__ 29 #define __KPV__ 1 30 31 /* The symbol __STD_C indicates that the language is ANSI-C or C++ */ 32 #ifndef __STD_C 33 #ifdef __STDC__ 34 #define __STD_C 1 35 #else 36 #if __cplusplus || c_plusplus 37 #define __STD_C 1 38 #else 39 #define __STD_C 0 40 #endif /*__cplusplus*/ 41 #endif /*__STDC__*/ 42 #endif /*__STD_C*/ 43 44 /* For C++, extern symbols must be protected against name mangling */ 45 #ifndef _BEGIN_EXTERNS_ 46 #if __cplusplus || c_plusplus 47 #define _BEGIN_EXTERNS_ extern "C" { 48 #define _END_EXTERNS_ } 49 #else 50 #define _BEGIN_EXTERNS_ 51 #define _END_EXTERNS_ 52 #endif 53 #endif /*_BEGIN_EXTERNS_*/ 54 55 /* _ARG_ simplifies function prototypes between K&R-C and more modern Cs */ 56 #ifndef _ARG_ 57 #if __STD_C 58 #define _ARG_(x) x 59 #else 60 #define _ARG_(x) () 61 #endif 62 #endif /*_ARG_*/ 63 64 /* The type Void_t is properly defined so that Void_t* can address any type */ 65 #ifndef Void_t 66 #if __STD_C 67 #define Void_t void 68 #else 69 #define Void_t char 70 #endif 71 #endif /*Void_t*/ 72 73 /* The below are for DLLs on systems such as WINDOWS that only 74 ** allows pointers across client ** and library code. 75 */ 76 #ifndef _PTR_ 77 #if _DLL_INDIRECT_DATA && !defined(_DLL) /* building client code */ 78 #define _ADR_ /* cannot export whole structs - data access via ptrs */ 79 #define _PTR_ * 80 #else /* library code or a normal system */ 81 #define _ADR_ & /* exporting whole struct is ok */ 82 #define _PTR_ 83 #endif 84 #endif /*_PTR_*/ 85 86 #endif /*__KPV__*/ 87 88 /* user-supplied functions to do io */ 89 typedef struct _vddisc_s Vddisc_t; 90 typedef int(* Vdio_f)_ARG_((Void_t*, int, long, Vddisc_t*)); 91 struct _vddisc_s 92 { long size; /* total data size */ 93 Void_t* data; /* data array */ 94 Vdio_f readf; /* to read data */ 95 Vdio_f writef; /* to write data */ 96 }; 97 98 /* magic header for delta output */ 99 #define VD_MAGIC "\026\004\000\002" 100 #define VD_MAGIC_OLD "vd02" 101 102 _BEGIN_EXTERNS_ 103 extern long vddelta _ARG_((Vddisc_t*,Vddisc_t*,Vddisc_t*)); 104 extern long vdupdate _ARG_((Vddisc_t*,Vddisc_t*,Vddisc_t*)); 105 extern int vdsqueeze _ARG_((Void_t*, int, Void_t*)); 106 extern int vdexpand _ARG_((Void_t*, int, Void_t*)); 107 _END_EXTERNS_ 108 109 #endif /*_VDELTA_H*/ 110