Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libvcodex/Vcwindow/vcwindow.h
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2003-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 <[email protected]> *
18
* *
19
***********************************************************************/
20
#ifndef _VCWINDOW_H
21
#define _VCWINDOW_H 1
22
23
/* Window matching algorithms for delta compression of large files.
24
**
25
** Written by Kiem-Phong Vo
26
*/
27
28
typedef struct _vcwmatch_s Vcwmatch_t;
29
typedef struct _vcwmethod_s Vcwmethod_t;
30
typedef struct _vcwdisc_s Vcwdisc_t;
31
typedef struct _vcwindow_s Vcwindow_t;
32
typedef int (*Vcwevent_f)_ARG_((Vcwindow_t*, int, Void_t*, Vcwdisc_t*));
33
34
struct _vcwmatch_s
35
{ int type; /* VCD_[SOURCE|TARGET]FILE */
36
Sfoff_t wpos; /* position in file */
37
ssize_t wsize; /* size of matching window */
38
Void_t* wdata; /* window data */
39
ssize_t msize; /* amount of data actually matched */
40
int more; /* more subwindows to process */
41
};
42
43
struct _vcwmethod_s
44
{ Vcwmatch_t* (*applyf)_ARG_((Vcwindow_t*, Void_t*, size_t, Sfoff_t));
45
int (*eventf)_ARG_((Vcwindow_t*, int));
46
char* name;
47
char* desc;
48
char* about;
49
};
50
51
struct _vcwdisc_s
52
{ Sfio_t* srcf; /* source file */
53
Sfio_t* tarf; /* target file if any */
54
Vcwevent_f eventf;
55
};
56
57
struct _vcwindow_s
58
{ Vcwmethod_t* meth;
59
Vcwdisc_t* disc;
60
ssize_t cmpsz; /* size of result of last comp. attempt */
61
Vcwmatch_t match; /* space to return the matching window */
62
Void_t* mtdata;
63
};
64
65
/* window events */
66
#define VCW_OPENING 0
67
#define VCW_CLOSING 1
68
69
#define vcwfeedback(vcw, sz) ((vcw)->cmpsz = (sz))
70
#define vcwapply(vcw, dt, dtsz, p) \
71
(*(vcw)->meth->applyf)((vcw), (dt), (dtsz), (p))
72
73
_BEGIN_EXTERNS_
74
75
#if _BLD_vcodex && defined(__EXPORT__)
76
#define extern extern __EXPORT__
77
#endif
78
#if !_BLD_vcodex && defined(__IMPORT__)
79
#define extern extern __IMPORT__
80
#endif
81
82
extern Vcwmethod_t* Vcwmirror;
83
extern Vcwmethod_t* Vcwvote;
84
extern Vcwmethod_t* Vcwprefix;
85
86
#undef extern
87
88
#if _BLD_vcodex && defined(__EXPORT__)
89
#define extern __EXPORT__
90
#endif
91
92
extern Vcwindow_t* vcwopen _ARG_((Vcwdisc_t*, Vcwmethod_t*));
93
extern int vcwclose _ARG_((Vcwindow_t*));
94
extern Vcwmethod_t* vcwgetmeth _ARG_((char*));
95
extern int vcwwalkmeth _ARG_((Vcwalk_f, Void_t*));
96
97
#undef extern
98
99
_END_EXTERNS_
100
101
#endif /*_VCWINDOW_H*/
102
103