1 /******************************************************************************
2 *
3 * Copyright (C) 2006, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: buf 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov
13 *
14 * Summary: This file provides functionality for 'buf' type.
15 *
16 ******************************************************************************/
17
18 #ifndef _BUF_
19 #define _BUF_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif // __cplusplus
24
25 #include "memory.h"
26
27 typedef struct
28 {
29 pubyte data; // Pointer to the allocated memory
30 uint use; // Using size
31 uint size; // All available size
32 uint step; // The minimum step of the increasing
33 } buf, * pbuf;
34
35 //--------------------------------------------------------------------------
36
37 pbuf STDCALL buf_add( pbuf pb, pbuf src );
38 pbuf STDCALL buf_alloc( pbuf pb, uint size );
39 pbuf STDCALL buf_array( pbuf pb, uint count );
40 pbuf STDCALL buf_clear( pbuf pb );
41 pbuf STDCALL buf_free( pbuf pb );
42 pbuf STDCALL buf_del( pbuf pb, uint off, uint size );
43 uint STDCALL buf_isequal( pbuf left, pbuf right );
44 pbuf STDCALL buf_append( pbuf pb, pubyte src, uint size );
45 pubyte STDCALL buf_appendtype( pbuf pb, uint size );
46 pbuf STDCALL buf_appendch( pbuf pb, ubyte val );
47 pbuf STDCALL buf_appenduint( pbuf pb, uint val );
48 pbuf STDCALL buf_appendulong( pbuf pb, ulong64 val );
49 pbuf STDCALL buf_appendushort( pbuf pb, ushort val );
50 pbuf STDCALL buf_copy( pbuf pb, pubyte src, uint size );
51 pbuf STDCALL buf_copyzero( pbuf pb, pubyte src );
52 void STDCALL buf_delete( pbuf pb );
53 pbuf STDCALL buf_expand( pbuf pb, uint size );
54 uint STDCALL buf_find( pbuf ps, uint offset, ubyte symbol );
55 uint STDCALL buf_findsh( pbuf ps, uint offset, ushort val );
56 pubyte STDCALL buf_index( pbuf pb, uint index );
57 pbuf STDCALL buf_init( pbuf pb );
58 pbuf STDCALL buf_insert( pbuf pb, uint off, pubyte data, uint size );
59 uint STDCALL buf_len( pbuf pb );
60 pubyte STDCALL buf_ptr( pbuf pb );
61 pbuf STDCALL buf_reserve( pbuf pb, uint size );
62 pbuf STDCALL buf_setlen( pbuf pb, uint size );
63 pbuf STDCALL buf_set( pbuf pb, pbuf src );
64 //pbuf STDCALL buf_subbuf( pbuf dest, pbuf src, uint off, uint len );
65
66 //--------------------------------------------------------------------------
67
68 #ifdef __cplusplus
69 }
70 #endif // __cplusplus
71
72 #endif // _BUF_
73
Редактировать