EnglishРусский  

   ..

   gea.g

   gead.g

   geademo.g

   geae.g

   geafile.g

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

Реклама

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

source\lib\gea\geafile.g
 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 func uint close( uint handle )
15 {
16    return CloseHandle( handle )
17 }
18 
19 func uint getftime( uint handle, filetime ft )
20 {
21    return GetFileTime( handle, 0->filetime, 0->filetime, ft )
22 }
23 
24 func long getlongsize( uint handle )
25 {
26    uint high low
27    
28    low = GetFileSize( handle, &high )
29    
30    return long( low ) | ( long( high ) << 32L )
31 }
32 
33 func uint getsize( uint handle )
34 {
35    return GetFileSize( handle, 0 )
36 }
37 
38 func uint open( str name, uint flag )
39 {
40    uint result = CreateFile( name.ptr(), ?( flag & $OP_READONLY, $GENERIC_READ, 
41                  $GENERIC_RW ), ?( flag & $OP_EXCLUSIVE, 0, 
42                  ?( flag & $OP_READONLY, /*$FILE_SHARE_READ*/$FILE_SHARE_RW, 
43                  $FILE_SHARE_RW )), 0, ?( flag & $OP_CREATE,
44                  $CREATE_ALWAYS, ?( flag & $OP_ALWAYS, $OPEN_ALWAYS, 
45                  $OPEN_EXISTING )), 0/* $FILE_FLAG_WRITE_THROUGH*/, 0 )
46    
47    return ?( result == $INVALID_HANDLE_VALUE, 0, result )
48 }
49 
50 func uint read( uint handle, buf rbuf, uint size )
51 {
52    uint  read
53 
54    if size > 16000000 
55    {
56       uint fsize = getsize( handle )
57       if size > fsize : size = fsize
58    } 
59    rbuf.expand( rbuf.use + size + 1 );
60 
61    if ReadFile( handle, rbuf.data + rbuf.use, size, &read, 0 ) 
62    { 
63       rbuf.use += read
64    }
65    return read;
66 }
67 
68 func uint setftime( uint handle, filetime ft )
69 {
70    return SetFileTime( handle, ft, ft, ft )
71 }
72 
73 func long setlongpos( uint handle, long pos, uint mode )
74 {
75    uint high low
76    
77    high = uint( pos >> 32L )
78    low = uint( pos )     
79    SetFilePointer( handle, low, &high, mode )
80    return pos
81 }
82 
83 func  uint setpos( uint handle, int offset, uint mode )
84 {
85    return SetFilePointer( handle, offset, 0, mode )
86 }
87 
88 func uint  write( uint handle, buf wbuf )
89 {
90    uint  write
91 
92    return WriteFile( handle, wbuf.data, *wbuf, &write, 0 ) && write == *wbuf
93 }
94 
Редактировать