Core agent is now working on NetWare
[public/netxms.git] / src / libnetxms / main.cpp
1 /*
2 ** NetXMS - Network Management System
3 ** Utility Library
4 ** Copyright (C) 2003 Victor Kirhenshtein
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 **
20 ** $module: main.cpp
21 **
22 **/
23
24 #include "libnetxms.h"
25
26
27 //
28 // Swap byte order in 64-bit integer
29 //
30
31 #if defined(_WIN32) || !(HAVE_DECL___BSWAP_64)
32
33 QWORD LIBNETXMS_EXPORTABLE __bswap_64(QWORD qwVal)
34 {
35 QWORD qwResult;
36 BYTE *sptr = (BYTE *)&qwVal;
37 BYTE *dptr = (BYTE *)&qwResult + 7;
38 int i;
39
40 for(i = 0; i < 8; i++, sptr++, dptr--)
41 *dptr = *sptr;
42
43 return qwResult;
44 }
45
46 #endif
47
48
49 //
50 // Swap bytes in double
51 //
52
53 double LIBNETXMS_EXPORTABLE __bswap_double(double dVal)
54 {
55 double dResult;
56 BYTE *sptr = (BYTE *)&dVal;
57 BYTE *dptr = (BYTE *)&dResult + 7;
58 int i;
59
60 for(i = 0; i < 8; i++, sptr++, dptr--)
61 *dptr = *sptr;
62
63 return dResult;
64 }
65
66
67 //
68 // strupr() implementation for non-windows platforms
69 //
70
71 #if !defined(_WIN32) && !defined(_NETWARE)
72
73 void LIBNETXMS_EXPORTABLE strupr(char *in)
74 {
75 char *p = in;
76
77 if (in == NULL)
78 {
79 return;
80 }
81
82 for (; *p != 0; p++)
83 {
84 // TODO: check/set locale
85 *p = toupper(*p);
86 }
87 }
88
89 #endif
90
91
92 //
93 // DLL entry point
94 //
95
96 #ifdef _WIN32
97
98 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
99 {
100 return TRUE;
101 }
102
103 #endif /* _WIN32 */
104
105
106 //
107 // NetWare library entry point
108 //
109
110 #ifdef _NETWARE
111
112 int _init(void)
113 {
114 return 0;
115 }
116
117 int _fini(void)
118 {
119 return 0;
120 }
121
122 #endif