EnglishРусский  

   ..

   compare.c

   fields.c

   ged.c

   ged.def

   ged.h

   record.c

   select.c

Данный проект закрыт! Создан новый скриптовый язык с тем же именем. Всё доступно на GitHub.
Также попробуйте нашу open source кроссплатформенную программу для создания и управления скриптами.

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

  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 #include "windows.h"
 15 #include "../../common/types.h"
 16 #include "../../os/user/defines.h"
 17 #include "../../algorithm/qsort.h"
 18 
 19 // Type of fields
 20 #define  FT_BYTE    1   // byte
 21 #define  FT_UBYTE   2   // unsigned byte
 22 #define  FT_SHORT   3   // short
 23 #define  FT_USHORT  4   // unsigned short
 24 #define  FT_INT     5   // int
 25 #define  FT_UINT    6   // unsigned int
 26 #define  FT_LONG    7   // long
 27 #define  FT_ULONG   8   // unsigned long
 28 #define  FT_FLOAT   9   // float
 29 #define  FT_DOUBLE  10   // double
 30 #define  FT_STR     11   // ANSI string ( 1-255 )
 31 #define  FT_USTR    12   // Unicode string ( 1-255 )
 32 
 33 // Select filter commands
 34 #define  SF_END     0   // Finish of commands
 35 #define  SF_ALL     1   // All records (exclude deleted)
 36 #define  SF_EQ      2   // field == value
 37 #define  SF_LESS    3   // field < value
 38 #define  SF_GREAT   4   // field > value
 39 
 40 #define  SF_NOT     0x10000000  // Not flag for commands
 41 #define  SF_OR      0x20000000  // OR to the next command, by default AND
 42 
 43 // Index flags
 44 #define  IF_DESC    0x10000000  // Descend order
 45 //#define  IF_END     0xFFFF      // End of the index list
 46 
 47 /* Code for additonal information
 48 [gedhead]
 49 ubyte  code
 50 ushort size of the information
 51        information
 52 */
 53 #define  GEI_GENTEE    1   // Gentee information
 54 
 55 // Error codes
 56 #define  GDE_OK        0   // No error
 57 #define  GDE_GEDEXIST  1   // ged base exists. What to do 
 58                            // 0 - overwrite 1 - error default - error
 59 #define  GDE_OPENFILE  2   // Cannot open file - filename in ged->dbfile
 60 #define  GDE_WRITEFILE 3   // Cannot write file - filename in ged->dbfile
 61 #define  GDE_FORMAT    4   // Format of database files is wrong
 62 #define  GDE_READFILE  5   // Cannot read file - filename in ged->dbfile
 63 
 64 #define  GED_STRING  0x00444547   // 'GE' string
 65 
 66 typedef uint  ( __cdecl *gentee_call )( uint, puint, ... );
 67 typedef int   ( __stdcall *cmp_func )( const pvoid, const pvoid );
 68 
 69 // Database header
 70 typedef struct _gedhead
 71 {
 72    uint     ext;       // GED string
 73    ubyte    size;      // Sizeof of the header structure
 74    uint     oversize;  // Size of all header information
 75    ushort   numfields; // Amount of columns
 76    ushort   autoid;    // The number of autoincrement field from 1
 77 } gedhead, * pgedhead;
 78 
 79 // Field init
 80 typedef struct _gedfieldinit
 81 {
 82    uint    ftype;        // hiword size for FT_STR & FT_USTR
 83    pubyte  name;
 84 } gedfieldinit, * pgedfieldinit; 
 85 
 86 // Database column info
 87 typedef struct _gedfield
 88 {
 89    uint    ftype;
 90    pubyte  name;
 91    uint    width;
 92    uint    offset;
 93 } gedfield, * pgedfield; 
 94 
 95 typedef struct _gedmem
 96 {
 97    buf          record;   // Temporary record
 98    buf          head;
 99    buf          data;     // Database 
100    str          dbfile;   // Name of database file
101    str          dbname;   // Name of database
102 } gedmem, * pgedmem;
103 
104 typedef struct _ged
105 {
106    pubyte       filename;       // Name of database file
107    gentee_call  call;           // gentee_call notify function
108    uint         nfyparam;       // The first parameter of gentee_call
109    uint         error;          // Pointer to error
110    uint         autoid;         // The latest auto id for open 
111                                 // for create == autoincrement field from 1
112 
113    pgedhead     head;     // Database header
114    pgedfield    fields;   // Pointer to columns info
115    pubyte       db;       // Pointer to the first record
116    uint         handle;   // Handle of the ged file
117    uint         fsize;    // The size of the field
118    uint         reccount; // The count of records
119    uint         reccur;   // The current record
120    pubyte       recptr;   // The pointer to the record
121    pgedmem      gm;
122 } ged, * pged;
123 
124 typedef struct _pselmem
125 {
126    buf   selected;   // selected records
127    buf   index;      // indexes
128    buf   filter;     // filters
129 } selmem, * pselmem;
130 
131 typedef struct _gedsel
132 {
133    pged         pdb;      // Database
134    uint         reccount; // The count of records
135    uint         reccur;   // The current record from 1 
136    pselmem      sm;
137 } gedsel, * pgedsel;
138 
139 
140 BOOL   ged_close( pged pdb );
141 BOOL   ged_create( pged pdb, pgedfieldinit pfi );
142 BOOL   ged_open( pged pdb );
143 uint   ged_goto( pged pdb, uint pos );
144 BOOL   ged_eof( pged pdb );
145 uint   ged_recno( pged pdb );
146 
147 pgedfield  ged_field( pged pdb, uint ind );
148 uint       ged_findfield( pged pdb, pubyte name );
149 pubyte     ged_fieldptr( pged pdb, uint ind, uint ifield );
150 uint       ged_getuint( pged pdb, uint ind, uint ifield );
151 long64     ged_getlong( pged pdb, uint ind, uint ifield );
152 float      ged_getfloat( pged pdb, uint ind, uint ifield );
153 double     ged_getdouble( pged pdb, uint ind, uint ifield );
154 
155 uint   ged_append( pged pdb, puint ptr );
156 uint   ged_isdel();
157 
158 BOOL   ged_write( pged pdb, pubyte data, long64 pos, uint size );
159 
160 BOOL   ges_select( pgedsel psel, pged pdb, puint filter, puint index );
161 BOOL   ges_close( pgedsel psel );
162 uint   ges_goto( pgedsel psel, uint pos );
163 BOOL   ges_index( pgedsel psel, puint index );
164 uint   ges_recno( pgedsel psel );
165 BOOL   ges_eof( pgedsel psel );
166 BOOL   ges_update( pgedsel psel );
167 BOOL   ges_updateindex( pgedsel psel );
168 BOOL   ges_reverse( pgedsel psel );
169 
170 
171 int   cmpubyte( pubyte left, pubyte right, uint len );
172 int   cmpushort( pushort left, pushort right, uint len );
173 int   cmpuint( puint left, puint right, uint len );
174 int   cmpbyte( char* left, char* right, uint len );
175 int   cmpshort( pshort left, pshort right, uint len );
176 int   cmpint( pint left, pint right, uint len );
177 int   cmpstr( pubyte left, pubyte right, uint len );
178 int   cmpustr( pushort left, pushort right, uint len );
179 
180 #define PDATA &pdb->gm->data
181 #define PFILE &pdb->gm->dbfile
182 #define PHEAD &pdb->gm->head
183 #define PRECORD &pdb->gm->record
184 
185 #define PSELECT &psel->sm->selected
186 #define PINDEX  &psel->sm->index
187 #define PFILTER &psel->sm->filter
188 //pubyte gedsel_goto( pgedsel psel, uint pos );
189 
190 
Редактировать