forked from bakagirl/Arachne-WWW-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUFBUF.H
90 lines (75 loc) · 4.23 KB
/
BUFBUF.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/***********************************************************************/
/* Function for saving and reloading buffers into XMS or to disk */
/***********************************************************************/
/* (c) Jan Vlaciha 1994 */
//int h_xmove(XMOVE *p); // umoznuje odkladat buffery liche delky
// tr.: makes it possible to save buffers of odd length
/***********************************************************************/
/* Saving buffers into XMS or to disk */
/***********************************************************************/
// Parameters: inbuf .... saved buffer
// lenbuf ... length in bytes
// bbuf ..... pointer for identification (see getIm)
// Return : 1 ........ O.K.
// 2 ........ error while allocating
// 4 ........ error while working with XMS
// 6 ........ error while writing to disk
// Funkce : Odlozi buffer do XMS nebo (kdyz neni XMS) na disk.
// Soubory na disku se poznaji podle pripony ._$B.
// Predpoklada se existence a nastaveni globalni promenne
// scratchBase se jmenem pracovniho adresare.
// Odkladat lze buffery do maximalni delky 64kB.
// tr.: Buffer is saved into XMS or (if there is no XMS) to disk.
// Files on disk are marked with the extension ._$B.
// Program supposes the existence and setting of a global
// variable scratchBase with the name of the working directory.
// Buffers can be saved up to a maximum length of 64kB.
struct T_buf_buf
{
unsigned int size; // buffer size
int handle; // handle into XMS, or number of file
char medium; // target medium ( 1 = XMS, 4 = disk )
};
//int saveBuf( char *inbuf, unsigned int lenbuf, char far **bbuf );
int saveBuf( char *inbuf, unsigned int lenbuf, struct T_buf_buf *bb );
/***********************************************************************/
/* Get length of saved buffer */
/***********************************************************************/
// Parameters: bbuf ..... pointer for identification
// Return : length of saved buffer
//unsigned int sizeBuf( char **bbuf );
unsigned int sizeBuf( struct T_buf_buf *bbuf );
/***********************************************************************/
/* Read from saved buffer */
/***********************************************************************/
// Parameters: outbuf ... saved buffer
// from ..... from which byte to read
// lenbuf ... input - how many bytes to read
// output - how many bytes have actually been read
// bbuf ..... pointer for identification (see getIm)
// Return : 1 ........ O.K.
// 2 ........ bbuf is NULL
// 4 ........ error while working with XMS
// 6 ........ error while writing to disk
// Funkce : Nacte pozadovanou cast odlozeneho bufferu.
// Nepodari-li se nacist pozadovanou delku,
// vrati se v lenbuf skutecne nactena delka.
// tr.: Reads requested part of the saved buffer. If it is not
// possible to read the requested length, lenbuf returns
// the length that has actually been read.
//int fromBuf( char *outbuf, unsigned int from,
// unsigned int *lenbuf, char far **bbuf );
int fromBuf( char *outbuf, unsigned int from,
unsigned int *lenbuf, struct T_buf_buf *bb );
/***********************************************************************/
/* Delete saved buffer */
/***********************************************************************/
// Parameters: bbuf ..... pointer for identification (see getIm)
// Return : 1 ........ O.K.
// 2 ........ bbuf is NULL
// 6 ........ failed to delete
//int delBuf( char far **bbuf );//very old format
//!!Bernie: Mar 04, 2007 -- complete rewrite as void in bufbuf.c
void delBuf( struct T_buf_buf *bb );
//int delBuf( struct T_buf_buf *bb );
//!!Bernie: end