| 1 | /* |
| 2 | * |
| 3 | * config.h |
| 4 | * |
| 5 | * $Id$ |
| 6 | * |
| 7 | * Configuration |
| 8 | * |
| 9 | * The iODBC driver manager. |
| 10 | * |
| 11 | * Copyright (C) 1995 by Ke Jin <kejin@empress.com> |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Library General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Library General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Library General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | #ifndef _CONFIG_H |
| 28 | #define _CONFIG_H |
| 29 | |
| 30 | #if !defined(WINDOWS) && !defined(WIN32_SYSTEM) |
| 31 | #define _UNIX_ |
| 32 | |
| 33 | #include "wx/setup.h" |
| 34 | |
| 35 | /* we have these definitions from configure */ |
| 36 | #if defined(HAVE_DLOPEN) |
| 37 | #define DLDAPI_SVR4_DLFCN |
| 38 | #elif define(HAVE_SHL_LOAD) |
| 39 | #define DLDAPI_HP_SHL |
| 40 | #endif |
| 41 | |
| 42 | #include <stdlib.h> |
| 43 | #include <sys/types.h> |
| 44 | #include <string.h> |
| 45 | #include <stdio.h> |
| 46 | |
| 47 | #define MEM_ALLOC(size) (malloc((size_t)(size))) |
| 48 | #define MEM_FREE(ptr) {if(ptr) free(ptr);} |
| 49 | |
| 50 | #define STRCPY(t, s) (strcpy((char*)(t), (char*)(s))) |
| 51 | #define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n))) |
| 52 | #define STRCAT(t, s) (strcat((char*)(t), (char*)(s))) |
| 53 | #define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n))) |
| 54 | #define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0) |
| 55 | #define STRLEN(str) ((str)? strlen((char*)(str)):0) |
| 56 | |
| 57 | #define EXPORT |
| 58 | #define CALLBACK |
| 59 | #define FAR |
| 60 | |
| 61 | typedef signed short SSHOR; |
| 62 | typedef short WORD; |
| 63 | typedef long DWORD; |
| 64 | |
| 65 | typedef WORD WPARAM; |
| 66 | typedef DWORD LPARAM; |
| 67 | typedef int BOOL; |
| 68 | #endif /* _UNIX_ */ |
| 69 | |
| 70 | #if defined(WINDOWS) || defined(WIN32_SYSTEM) |
| 71 | #include <windows.h> |
| 72 | #include <windowsx.h> |
| 73 | |
| 74 | #ifdef _MSVC_ |
| 75 | #define MEM_ALLOC(size) (fmalloc((size_t)(size))) |
| 76 | #define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0)) |
| 77 | #define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s))) |
| 78 | #define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) |
| 79 | #define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0) |
| 80 | #define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) |
| 81 | #endif |
| 82 | |
| 83 | #ifdef _BORLAND_ |
| 84 | #define MEM_ALLOC(size) (farmalloc((unsigned long)(size)) |
| 85 | #define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0) |
| 86 | #define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s))) |
| 87 | #define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) |
| 88 | #define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0) |
| 89 | #define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) |
| 90 | #endif |
| 91 | |
| 92 | #endif /* WINDOWS */ |
| 93 | |
| 94 | #define SYSERR (-1) |
| 95 | |
| 96 | #ifndef NULL |
| 97 | #define NULL ((void FAR*)0UL) |
| 98 | #endif |
| 99 | |
| 100 | #endif |