PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/os/windows/ftk_win32.h

http://ftk.googlecode.com/
C++ Header | 113 lines | 62 code | 22 blank | 29 comment | 0 complexity | 476e8b9cc51768ca3cfdd2357bfada47 MD5 | raw file
  1/*
  2 * File: ftk_win32.h
  3 * Author:  Li XianJing <xianjimli@hotmail.com>
  4 * Brief:   win32 specific functions.
  5 *
  6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
  7 *
  8 * Licensed under the Academic Free License version 2.1
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or
 13 * (at your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program; if not, write to the Free Software
 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 23 */
 24
 25/*
 26 * History:
 27 * ================================================================
 28 * 2009-11-22 Li XianJing <xianjimli@hotmail.com> created
 29 *
 30 */
 31
 32#ifndef FTK_WIN32_H
 33#define FTK_WIN32_H
 34
 35#ifdef WIN32
 36
 37#define FTK_HAS_LOAD_LIBRARY 1
 38#define  _CRT_SECURE_NO_WARNINGS 1
 39#define FTK_HAS_L
 40#include <io.h>
 41#include <time.h>
 42#include <stdio.h>
 43#include <windows.h>
 44#include <sys/stat.h>
 45#include <sys/types.h>
 46
 47#define HAVE_BOOLEAN
 48#define inline 
 49
 50char* ftk_get_root_dir(void);
 51char* ftk_get_data_dir(void);
 52char* ftk_get_testdata_dir(void);
 53
 54#define __func__       __FILE__
 55#define FTK_ROOT_DIR   ftk_get_root_dir()
 56#define FTK_FONT       "\\gb2312.fnt"
 57#define DATA_DIR       ftk_get_root_dir()
 58#define LOCAL_DATA_DIR ftk_get_root_dir()
 59#define FTK_DATA_ROOT  ftk_get_data_dir()
 60#define TESTDATA_DIR   ftk_get_testdata_dir()
 61
 62#define _CRT_SECURE_NO_WARNINGS 1
 63
 64#define usleep        Sleep
 65#define ftk_getcwd    _getcwd
 66#define ftk_sscanf    sscanf
 67#define stat _stat
 68#define strcasecmp _stricmp
 69
 70
 71#define S_IFDIR _S_IFDIR
 72#define S_IFREG _S_IFREG
 73#define S_ISDIR(a) ((a) & S_IFDIR)
 74
 75struct dirent
 76{
 77	unsigned char d_type;       
 78	char d_name[256];
 79};
 80
 81typedef struct _DIR
 82{
 83	long handle;
 84	struct dirent dir;
 85}DIR;
 86
 87#define rmdir _rmdir
 88#define mkdir _mkdir
 89#define chdir _chdir
 90
 91DIR *opendir(const char *name);
 92struct dirent *readdir(DIR *dir);
 93int closedir(DIR *dir);
 94
 95char* ftk_strncpy(char *dest, const char *src, size_t n);
 96int   ftk_snprintf(char *str, size_t size, const char *format, ...);
 97int   ftk_vsnprintf(char *str, size_t size, const char *format, va_list ap);
 98
 99size_t ftk_get_relative_time(void);
100int   win32_socketpair(SOCKET socks[2]);
101
102#define ftk_pipe_pair(fds)				win32_socketpair(fds)
103#define ftk_pipe_close(fd)				closesocket(fd)
104#define ftk_pipe_recv(fd, buf, length)	recv(fd, buf, length, 0)
105#define ftk_pipe_send(fd, buf, length)	send(fd, buf, length, 0)
106#define FTK_PATH_DELIM '\\'
107
108#define USE_FTK_MAIN 1
109
110#endif
111
112#endif/*FTK_WIN32_H*/
113