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: defines 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov
13 *
14 * Summary: This file provides Windows basic types and some constants.
15 *
16 ******************************************************************************/
17
18 #ifndef _DEFINES_
19 #define _DEFINES_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif // __cplusplus
24
25 #include <stdio.h>
26 #include <stdarg.h>
27 #ifdef LINUX
28 #include <time.h>
29 #include <stdlib.h>
30 #include "ini.h"
31 #include <locale.h>
32 #else
33 #include <windows.h>
34 #include <conio.h>
35 #endif
36 #include "../../common/str.h"
37
38 //--------------------------------------------------------------------------
39 #ifdef LINUX
40 #define SLASH '/' // Filename divider
41 #else
42 #define SLASH '\\' // Filename divider
43 #define OS_CRL CRITICAL_SECTION // type
44 #endif
45
46 #define os_alloc malloc
47 #define os_free free
48 //#define os_lower CharLower
49 #define os_crlsection_delete DeleteCriticalSection
50 #define os_crlsection_enter EnterCriticalSection
51 #define os_crlsection_init InitializeCriticalSection
52 #define os_crlsection_leave LeaveCriticalSection
53 //#define os_exitthread pthread_exit
54 #define os_isleadbyte IsDBCSLeadByte
55 #define os_wait WaitForSingleObject
56 #define os_exitcode GetExitCodeThread
57
58 //#define os_time GetTickCount
59
60 uint STDCALL os_dircreate( pstr name );
61 uint STDCALL os_getattrib( pstr name );
62 uint STDCALL os_dirdelete( pstr name );
63 pstr STDCALL os_dirgetcur( pstr name );
64 uint STDCALL os_dirsetcur( pstr name );
65 uint STDCALL os_dirdeletefull( pstr name );
66
67
68 uint STDCALL os_fileclose( uint handle );
69 uint STDCALL os_filedelete( pstr name );
70 uint STDCALL os_fileexist( pstr name );
71 //pstr STDCALL os_filefullname( pstr filename, pstr result );
72 pvoid STDCALL os_filefullname( pubyte filename, pvoid buf );
73
74 uint STDCALL os_fileopen( pstr name, uint flag );
75 ulong64 STDCALL os_filepos( uint handle, long64 offset, uint mode );
76 uint STDCALL os_fileread( uint handle, pubyte data, uint size );
77 ulong64 STDCALL os_filesize( uint handle );
78 uint STDCALL os_filewrite( uint handle, pubyte data, uint size );
79
80 uint STDCALL os_multibytes( void );
81 void STDCALL os_init( uint param );
82 void STDCALL os_print( pubyte ptr, uint len );
83 uint STDCALL os_getchar( void );
84 uint STDCALL os_scan( pubyte input, uint len );
85 int STDCALL os_strcmp( pubyte one, pubyte two );
86 int STDCALL os_strcmpign( pubyte one, pubyte two );
87 int STDCALL os_strcmplen( pubyte one, pubyte two, uint len );
88 int STDCALL os_strcmpignlen( pubyte one, pubyte two, uint len );
89 int STDCALL os_ustrcmp( pushort one, pushort two );
90 int STDCALL os_ustrcmpign( pushort one, pushort two );
91 int STDCALL os_ustrcmplen( pushort one, pushort two, uint len );
92 int STDCALL os_ustrcmpignlen( pushort one, pushort two, uint len );
93 pstr STDCALL os_tempdir( pstr name );
94 pstr STDCALL os_gettemp( void );
95 pvoid STDCALL os_thread(pvoid pfunc,pvoid param);
96
97 void STDCALL os_exitthread(long retcode);
98 pubyte STDCALL os_lower(pubyte pData);
99 uint STDCALL os_time();
100 pubyte STDCALL strlower1(pubyte string1);
101 pubyte STDCALL os_getexepath( pubyte dir, pubyte name );
102 pubyte STDCALL os_getexename( pubyte dir);
103
104
105 //pvoid STDCALL os_alloc( uint size );
106 //void STDCALL os_free( pvoid ptr );
107
108 //--------------------------------------------------------------------------
109
110 #ifdef __cplusplus
111 }
112 #endif // __cplusplus
113
114 #endif // _DEFINES_
115
Редактировать