1 /******************************************************************************
2 *
3 * Copyright (C) 2009, 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 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 define
15 {
16 // Type of fields
17 FT_BYTE = 1 // byte
18 FT_UBYTE = 2 // unsigned byte
19 FT_SHORT = 3 // short
20 FT_USHORT = 4 // unsigned short
21 FT_INT = 5 // int
22 FT_UINT = 6 // unsigned int
23 FT_LONG = 7 // long
24 FT_ULONG = 8 // unsigned long
25 FT_FLOAT = 9 // float
26 FT_DOUBLE = 10 // double
27 FT_STR = 11 // ANSI string ( 1-255 )
28 FT_USTR = 12 // Unicode string ( 1-255 )
29
30 // Flags for _gedfield.param
31 FTF_AUTO = 0x10000000 // Auto-increment (for FT_BYTE - FT_LONG)
32
33 SF_END = 0 // Finish of commands
34 SF_ALL = 1 // All records (exclude deleted)
35 SF_EQ = 2 // field == ival
36 SF_LESS = 3 // field < ival
37 SF_GREAT = 4 // field > ival
38
39 SF_NOT = 0x10000000 // Not flag for commands
40 SF_OR = 0x20000000 // OR to the next command, by default AND
41
42 // Index flags
43 IF_DESC = 0x10000000 // Descend order
44 IF_END = 0xFFFF // End of the index list
45
46 // Error codes
47 GDE_OK = 0 // No error
48 GDE_GEDEXIST
49 GDE_OPENFILE // Cannot open file - filename in ged->dbfile
50 GDE_WRITEFILE // Cannot write file - filename in ged->dbfile
51 GDE_FORMAT // Format of database files is wrong
52 GDE_READFILE // Cannot read file - filename in ged->dbfile
53 }
54
55 // Database header
56 type gedhead
57 {
58 uint ext // GED string
59 ubyte size // Sizeof of the header structure
60 uint oversize // Size of all header information
61 ushort numfields // Amount of columns
62 ushort autoid; // The number of autoincrement field from 1
63 }
64
65 // Field init
66 type gedfieldinit
67 {
68 uint ftype
69 uint name
70 }
71
72 // Database column info
73 type gedfield
74 {
75 uint ftype
76 uint name
77 uint width
78 uint offset
79 }
80
81 type gedfields <inherit=arr index=gedfieldinit>
82 {
83 }
84
85 type ged
86 {
87 uint filename // Name of database file
88 uint call // gentee_call notify function
89 uint nfyparam // The first parameter of gentee_call
90 uint error // Error code
91 uint autoid // The latest auto id for open
92 // for create == autoincrement field from 1
93
94 uint head // Database header
95 uint fields // Pointer to columns info
96 uint db // Pointer to the first record
97 uint handle // Handle of the ged file
98 uint fsize // The size of the field
99 uint reccount // The count of records
100 uint reccur // The current record
101 uint recptr // The pointer to the record
102 uint gm
103 }
104
105 type gedsel
106 {
107 uint pdb // Database
108 uint reccount // The count of records
109 uint reccur // The current record from 1
110 uint sm
111 }
112
113 import "ged.dll"<exe>
114 {
115 uint ged_append( ged, uint )
116 uint ged_close( ged )
117 uint ged_create( ged, uint )
118 uint ged_eof( ged )
119 uint ged_field( ged, uint )
120 uint ged_fieldptr( ged, uint, uint )
121 uint ged_findfield( ged, uint )
122 uint ged_getuint( ged, uint, uint )
123 long ged_getlong( ged, uint, uint )
124 float ged_getfloat( ged, uint, uint )
125 double ged_getdouble( ged, uint, uint )
126 uint ged_goto( ged, uint )
127 uint ged_isdel( ged )
128 uint ged_open( ged )
129 uint ged_recno( ged )
130
131 uint ges_select( gedsel, ged, uint, uint )
132 uint ges_close( gedsel )
133 uint ges_goto( gedsel, uint )
134 uint ges_recno( gedsel )
135 uint ges_eof( gedsel )
136 uint ges_reverse( gedsel )
137 uint ges_updateindex( gedsel )
138 uint ges_update( gedsel )
139
140 /*
141 uint ged_goto( uint, uint )
142 uint ged_records( uint )*/
143 }
144
145 include
146 {
147 "gedbase.g"
148 "gedfield.g"
149 "gedrecord.g"
150 "gedselect.g"
151 }
152
Редактировать