From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- win/3rdparty/README.3rdparty | 15 + win/9x/Makefile | 19 + win/9x/Makefile.rel | 19 + win/asm/byteorder.h | 120 +++++ win/asm/socket.h | 78 +++ win/bootstrap.cpp | 135 +++++ win/common.pro | 198 ++++++++ win/config.h | 54 ++ win/ctype.h | 37 ++ win/dirent.h | 93 ++++ win/dummy.cpp | 34 ++ win/fcntl.c | 27 + win/fcntl.h | 97 ++++ win/fsync.c | 35 ++ win/getenv.c | 42 ++ win/grp.c | 46 ++ win/grp.h | 47 ++ win/in.h | 184 +++++++ win/kde_file_win.c | 139 ++++++ win/kde_file_win.h | 84 ++++ win/kdelibs_export_win.h | 152 ++++++ win/kdelibs_global_win.h | 200 ++++++++ win/kdemacros.h | 1 + win/limits.h | 28 ++ win/machine/types.h | 65 +++ win/mmap.c | 152 ++++++ win/net.c | 47 ++ win/netdb.h | 21 + win/netinet/in.h | 33 ++ win/pro_files/README.pro_files | 14 + win/pro_files/dcop/KDE-ICE/KDE-ICE.pro | 37 ++ win/pro_files/dcop/client/client.pro | 18 + win/pro_files/dcop/client/dcop/dcop.pro | 18 + win/pro_files/dcop/client/dcopfind/dcopfind.pro | 18 + win/pro_files/dcop/client/dcopref/dcopref.pro | 18 + win/pro_files/dcop/dcop.pro | 19 + win/pro_files/dcop/dcopidl/dcopidl.pro | 21 + win/pro_files/dcop/dcopidl2cpp/dcopidl2cpp.pro | 18 + win/pro_files/dcop/dcopserver/dcopserver.pro | 19 + .../dcopserver_shutdown/dcopserver_shutdown.pro | 17 + win/pro_files/dcop/iceauth/iceauth.pro | 16 + win/pro_files/dcop/testdcop/testdcop.pro | 14 + win/pro_files/dcop/tests/build_win.sh | 6 + win/pro_files/dcop/tests/dcop_test.pro | 15 + win/pro_files/dcop/tests/driver.pro | 15 + win/pro_files/dcop/tests/tests.pro | 31 ++ win/pro_files/interfaces/interfaces.pro | 4 + .../interfaces/ktexteditor/ktexteditor.pro | 74 +++ win/pro_files/kabc/kabc.pro | 40 ++ win/pro_files/kabc/vcard/vcard.pro | 22 + win/pro_files/kate/interfaces/interfaces.pro | 22 + win/pro_files/kate/kate.pro | 6 + win/pro_files/kate/part/part.pro | 43 ++ .../kdecore/kconfig_compiler/kconfig_compiler.pro | 18 + win/pro_files/kdecore/kdecore.pro | 143 ++++++ win/pro_files/kded/kded.pro | 36 ++ win/pro_files/kded/kded_rel.pro | 12 + win/pro_files/kded/makeall.sh | 4 + win/pro_files/kded/makeall_rel.sh | 4 + win/pro_files/kdefx/kdefx.pro | 22 + win/pro_files/kdefx/kdefx_rel.pro | 27 + win/pro_files/kdeprint/kdeprint.pro | 15 + win/pro_files/kdeui/kdeui.pro | 148 ++++++ win/pro_files/kdewidgets/kdewidgets.pro | 20 + win/pro_files/kdewidgets/makekdewidgets.pro | 19 + .../kio/kfile/tests/kfiletreeviewtest.pro | 29 ++ win/pro_files/kio/kio.pro | 212 ++++++++ win/pro_files/kioslave/bzip2/bzip2.pro | 10 + win/pro_files/kioslave/common.pro | 8 + win/pro_files/kioslave/gzip/gzip.pro | 9 + win/pro_files/kioslave/kioslave.pro | 11 + win/pro_files/kmdi/kmdi.pro | 31 ++ win/pro_files/kmdi/test/test.pro | 25 + win/pro_files/kparts/kparts.pro | 31 ++ win/pro_files/kresources/kresources.pro | 35 ++ .../kstyles/activeheart/widget-engine/genembed.pro | 17 + .../activeheart/widget-engine/widget-engine.pro | 17 + win/pro_files/kstyles/common.pro | 12 + win/pro_files/kstyles/dotNET/dotnet/dotnet.pro | 10 + win/pro_files/kstyles/highcolor/highcolor.pro | 10 + win/pro_files/kstyles/keramik/genembed.pro | 17 + win/pro_files/kstyles/keramik/keramik.pro | 14 + win/pro_files/kstyles/klegacy/klegacy.pro | 8 + win/pro_files/kstyles/kstyles.pro | 11 + win/pro_files/kstyles/kthemestyle/themestyle.pro | 15 + win/pro_files/kstyles/light/light.pro | 11 + win/pro_files/kstyles/plastik/plastik.pro | 9 + .../kstyles/slickerstyle/slicker/slicker.pro | 8 + .../kstyles/thinkeramik/widget-engine/genembed.pro | 26 + .../thinkeramik/widget-engine/thinkeramik_rel.pro | 50 ++ .../thinkeramik/widget-engine/widget-engine.pro | 26 + win/pro_files/kutils/kutils.pro | 26 + win/pro_files/libltdl/libltdl.pro | 19 + win/pwd.c | 53 ++ win/pwd.h | 73 +++ win/qeventloopex.cpp | 552 +++++++++++++++++++++ win/qeventloopex.h | 58 +++ win/readdir.c | 146 ++++++ win/readdir.h | 104 ++++ win/realpath.c | 114 +++++ win/resource.c | 37 ++ win/resources/kbuildsycoca.res | Bin 0 -> 2332 bytes win/signal.c | 53 ++ win/signal.h | 77 +++ win/socket.h | 169 +++++++ win/stdint.h | 191 +++++++ win/stdlib.h | 57 +++ win/string.h | 53 ++ win/strings.h | 22 + win/strndup.c | 35 ++ win/sys/fcntl.h | 26 + win/sys/file.h | 35 ++ win/sys/lock.h | 41 ++ win/sys/mman.h | 58 +++ win/sys/param.h | 38 ++ win/sys/resource.h | 91 ++++ win/sys/signal.h | 20 + win/sys/socket.h | 71 +++ win/sys/stat.h | 108 ++++ win/sys/time.h | 51 ++ win/sys/times.h | 49 ++ win/sys/types.h | 61 +++ win/sys/uio.h | 20 + win/sys/un.h | 35 ++ win/sys/utsname.h | 44 ++ win/sys/wait.h | 82 +++ win/syslog.c | 42 ++ win/syslog.h | 99 ++++ win/time.c | 33 ++ win/tools/.build_kdelibs_comon | 14 + win/tools/.check_kde_env | 22 + win/tools/.copy_missing_headers | 25 + win/tools/README.tools | 6 + win/tools/build_kdelibs_dbg | 82 +++ win/tools/build_kdelibs_rel | 73 +++ win/tools/collect_kdelibs_pro_files | 22 + win/tools/kdcopidl | 25 + win/tools/kde_env | 29 ++ win/tools/kde_env_custom.template | 15 + win/tools/kmoc | 19 + win/tools/mkrel | 11 + win/tools/update_kdelibs_pro_files | 30 ++ win/uname.c | 263 ++++++++++ win/unistd.c | 179 +++++++ win/unistd.h | 130 +++++ win/utime.h | 22 + win/win.pro | 54 ++ win/win32_utils.c | 81 +++ win/win32_utils.h | 96 ++++ win/win32_utils2.cpp | 154 ++++++ win/zlib.pro | 10 + 151 files changed, 8062 insertions(+) create mode 100644 win/3rdparty/README.3rdparty create mode 100644 win/9x/Makefile create mode 100644 win/9x/Makefile.rel create mode 100644 win/asm/byteorder.h create mode 100644 win/asm/socket.h create mode 100644 win/bootstrap.cpp create mode 100644 win/common.pro create mode 100644 win/config.h create mode 100644 win/ctype.h create mode 100644 win/dirent.h create mode 100644 win/dummy.cpp create mode 100644 win/fcntl.c create mode 100644 win/fcntl.h create mode 100644 win/fsync.c create mode 100644 win/getenv.c create mode 100644 win/grp.c create mode 100644 win/grp.h create mode 100644 win/in.h create mode 100644 win/kde_file_win.c create mode 100644 win/kde_file_win.h create mode 100644 win/kdelibs_export_win.h create mode 100644 win/kdelibs_global_win.h create mode 100644 win/kdemacros.h create mode 100644 win/limits.h create mode 100644 win/machine/types.h create mode 100644 win/mmap.c create mode 100644 win/net.c create mode 100644 win/netdb.h create mode 100644 win/netinet/in.h create mode 100644 win/pro_files/README.pro_files create mode 100644 win/pro_files/dcop/KDE-ICE/KDE-ICE.pro create mode 100644 win/pro_files/dcop/client/client.pro create mode 100644 win/pro_files/dcop/client/dcop/dcop.pro create mode 100644 win/pro_files/dcop/client/dcopfind/dcopfind.pro create mode 100644 win/pro_files/dcop/client/dcopref/dcopref.pro create mode 100644 win/pro_files/dcop/dcop.pro create mode 100644 win/pro_files/dcop/dcopidl/dcopidl.pro create mode 100644 win/pro_files/dcop/dcopidl2cpp/dcopidl2cpp.pro create mode 100644 win/pro_files/dcop/dcopserver/dcopserver.pro create mode 100644 win/pro_files/dcop/dcopserver_shutdown/dcopserver_shutdown.pro create mode 100644 win/pro_files/dcop/iceauth/iceauth.pro create mode 100644 win/pro_files/dcop/testdcop/testdcop.pro create mode 100755 win/pro_files/dcop/tests/build_win.sh create mode 100644 win/pro_files/dcop/tests/dcop_test.pro create mode 100644 win/pro_files/dcop/tests/driver.pro create mode 100644 win/pro_files/dcop/tests/tests.pro create mode 100644 win/pro_files/interfaces/interfaces.pro create mode 100644 win/pro_files/interfaces/ktexteditor/ktexteditor.pro create mode 100644 win/pro_files/kabc/kabc.pro create mode 100644 win/pro_files/kabc/vcard/vcard.pro create mode 100644 win/pro_files/kate/interfaces/interfaces.pro create mode 100644 win/pro_files/kate/kate.pro create mode 100644 win/pro_files/kate/part/part.pro create mode 100644 win/pro_files/kdecore/kconfig_compiler/kconfig_compiler.pro create mode 100644 win/pro_files/kdecore/kdecore.pro create mode 100644 win/pro_files/kded/kded.pro create mode 100644 win/pro_files/kded/kded_rel.pro create mode 100755 win/pro_files/kded/makeall.sh create mode 100755 win/pro_files/kded/makeall_rel.sh create mode 100644 win/pro_files/kdefx/kdefx.pro create mode 100644 win/pro_files/kdefx/kdefx_rel.pro create mode 100644 win/pro_files/kdeprint/kdeprint.pro create mode 100644 win/pro_files/kdeui/kdeui.pro create mode 100644 win/pro_files/kdewidgets/kdewidgets.pro create mode 100644 win/pro_files/kdewidgets/makekdewidgets.pro create mode 100644 win/pro_files/kio/kfile/tests/kfiletreeviewtest.pro create mode 100644 win/pro_files/kio/kio.pro create mode 100644 win/pro_files/kioslave/bzip2/bzip2.pro create mode 100644 win/pro_files/kioslave/common.pro create mode 100644 win/pro_files/kioslave/gzip/gzip.pro create mode 100644 win/pro_files/kioslave/kioslave.pro create mode 100644 win/pro_files/kmdi/kmdi.pro create mode 100644 win/pro_files/kmdi/test/test.pro create mode 100644 win/pro_files/kparts/kparts.pro create mode 100644 win/pro_files/kresources/kresources.pro create mode 100644 win/pro_files/kstyles/activeheart/widget-engine/genembed.pro create mode 100644 win/pro_files/kstyles/activeheart/widget-engine/widget-engine.pro create mode 100644 win/pro_files/kstyles/common.pro create mode 100644 win/pro_files/kstyles/dotNET/dotnet/dotnet.pro create mode 100644 win/pro_files/kstyles/highcolor/highcolor.pro create mode 100644 win/pro_files/kstyles/keramik/genembed.pro create mode 100644 win/pro_files/kstyles/keramik/keramik.pro create mode 100644 win/pro_files/kstyles/klegacy/klegacy.pro create mode 100644 win/pro_files/kstyles/kstyles.pro create mode 100644 win/pro_files/kstyles/kthemestyle/themestyle.pro create mode 100644 win/pro_files/kstyles/light/light.pro create mode 100644 win/pro_files/kstyles/plastik/plastik.pro create mode 100644 win/pro_files/kstyles/slickerstyle/slicker/slicker.pro create mode 100644 win/pro_files/kstyles/thinkeramik/widget-engine/genembed.pro create mode 100644 win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro create mode 100644 win/pro_files/kstyles/thinkeramik/widget-engine/widget-engine.pro create mode 100644 win/pro_files/kutils/kutils.pro create mode 100644 win/pro_files/libltdl/libltdl.pro create mode 100644 win/pwd.c create mode 100644 win/pwd.h create mode 100644 win/qeventloopex.cpp create mode 100644 win/qeventloopex.h create mode 100644 win/readdir.c create mode 100644 win/readdir.h create mode 100644 win/realpath.c create mode 100644 win/resource.c create mode 100644 win/resources/kbuildsycoca.res create mode 100644 win/signal.c create mode 100644 win/signal.h create mode 100644 win/socket.h create mode 100644 win/stdint.h create mode 100644 win/stdlib.h create mode 100644 win/string.h create mode 100644 win/strings.h create mode 100644 win/strndup.c create mode 100644 win/sys/fcntl.h create mode 100644 win/sys/file.h create mode 100644 win/sys/lock.h create mode 100644 win/sys/mman.h create mode 100644 win/sys/param.h create mode 100644 win/sys/resource.h create mode 100644 win/sys/signal.h create mode 100644 win/sys/socket.h create mode 100644 win/sys/stat.h create mode 100644 win/sys/time.h create mode 100644 win/sys/times.h create mode 100644 win/sys/types.h create mode 100644 win/sys/uio.h create mode 100644 win/sys/un.h create mode 100644 win/sys/utsname.h create mode 100644 win/sys/wait.h create mode 100644 win/syslog.c create mode 100644 win/syslog.h create mode 100644 win/time.c create mode 100755 win/tools/.build_kdelibs_comon create mode 100755 win/tools/.check_kde_env create mode 100755 win/tools/.copy_missing_headers create mode 100644 win/tools/README.tools create mode 100644 win/tools/build_kdelibs_dbg create mode 100644 win/tools/build_kdelibs_rel create mode 100755 win/tools/collect_kdelibs_pro_files create mode 100755 win/tools/kdcopidl create mode 100755 win/tools/kde_env create mode 100755 win/tools/kde_env_custom.template create mode 100755 win/tools/kmoc create mode 100755 win/tools/mkrel create mode 100755 win/tools/update_kdelibs_pro_files create mode 100644 win/uname.c create mode 100644 win/unistd.c create mode 100644 win/unistd.h create mode 100644 win/utime.h create mode 100644 win/win.pro create mode 100644 win/win32_utils.c create mode 100644 win/win32_utils.h create mode 100644 win/win32_utils2.cpp create mode 100644 win/zlib.pro (limited to 'win') diff --git a/win/3rdparty/README.3rdparty b/win/3rdparty/README.3rdparty new file mode 100644 index 000000000..5b5066896 --- /dev/null +++ b/win/3rdparty/README.3rdparty @@ -0,0 +1,15 @@ +3rdparty source code + +Contents: +- zlib/ +- bzip2/ + +You need to download and unpack source code here and build it +or at least put here necessary header files. + +Optionally you can also get binaries and copy include files to above +directories. + +You can give up with touching zlib diectory at all if your Qt library +contains zlib. + diff --git a/win/9x/Makefile b/win/9x/Makefile new file mode 100644 index 000000000..b2d7f33f2 --- /dev/null +++ b/win/9x/Makefile @@ -0,0 +1,19 @@ + +all: Makefile + cd .. && qmake CONFIG+=WIN9x -o Makefile.win9x && nmake -nologo -f Makefile.win9x + +clean: + del obj\*.obj + +FORCE: + +distclean: clean + +####### Compile + +####### Install + +install: + +uninstall: + diff --git a/win/9x/Makefile.rel b/win/9x/Makefile.rel new file mode 100644 index 000000000..39ad12cba --- /dev/null +++ b/win/9x/Makefile.rel @@ -0,0 +1,19 @@ + +all: Makefile.rel + cd .. && qmake KW_CONFIG=release CONFIG+=WIN9x -o Makefile.win9x.release && nmake -nologo -f Makefile.win9x.release + +clean: + del obj_rel\*.obj + +FORCE: + +distclean: clean + +####### Compile + +####### Install + +install: + +uninstall: + diff --git a/win/asm/byteorder.h b/win/asm/byteorder.h new file mode 100644 index 000000000..d828465c4 --- /dev/null +++ b/win/asm/byteorder.h @@ -0,0 +1,120 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _BYTEORDER_H +#define _BYTEORDER_H + +#undef INCL_WINSOCK_API_PROTOTYPES +#define INCL_WINSOCK_API_PROTOTYPES 1 //for ntohl(), etc. +#include //struct timeval, ntohl(), etc + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +#undef ntohl +#undef ntohs +#undef htonl +#undef htons +#endif + +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif + +#ifndef __LITTLE_ENDIAN_BITFIELD +#define __LITTLE_ENDIAN_BITFIELD +#endif + +#if 1 +//defined in winsock: extern unsigned long int ntohl(unsigned long int); +//defined in winsock: extern unsigned short int ntohs(unsigned short int); +//defined in winsock: extern unsigned long int htonl(unsigned long int); +//defined in winsock: extern unsigned short int htons(unsigned short int); + +/* +extern __inline__ unsigned long int __ntohl(unsigned long int); +extern __inline__ unsigned short int __ntohs(unsigned short int); +extern __inline__ unsigned long int __constant_ntohl(unsigned long int); +extern __inline__ unsigned short int __constant_ntohs(unsigned short int); +*/ + +/* +extern __inline__ unsigned long int +__ntohl(unsigned long int x) +{ + __asm__("xchgb %b0,%h0\n\t" // swap lower bytes + "rorl $16,%0\n\t" // swap words + "xchgb %b0,%h0" // swap higher bytes + :"=q" (x) + : "0" (x)); + return x; +} +*/ + +#define __constant_ntohl(x) \ + ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ + (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ + (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ + (((unsigned long int)(x) & 0xff000000U) >> 24))) +/* +extern __inline__ unsigned short int +__ntohs(unsigned short int x) +{ + __asm__("xchgb %b0,%h0" // swap bytes + : "=q" (x) + : "0" (x)); + return x; +} +*/ +#define __constant_ntohs(x) \ + ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ + (((unsigned short int)(x) & 0xff00) >> 8))) \ + +#define __htonl(x) __ntohl(x) +#define __htons(x) __ntohs(x) +#define __constant_htonl(x) __constant_ntohl(x) +#define __constant_htons(x) __constant_ntohs(x) + +#ifdef __OPTIMIZE__ +# define ntohl(x) \ +(__builtin_constant_p((long)(x)) ? \ + __constant_ntohl((x)) : \ + __ntohl((x))) +# define ntohs(x) \ +(__builtin_constant_p((short)(x)) ? \ + __constant_ntohs((x)) : \ + __ntohs((x))) +# define htonl(x) \ +(__builtin_constant_p((long)(x)) ? \ + __constant_htonl((x)) : \ + __htonl((x))) +# define htons(x) \ +(__builtin_constant_p((short)(x)) ? \ + __constant_htons((x)) : \ + __htons((x))) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/win/asm/socket.h b/win/asm/socket.h new file mode 100644 index 000000000..3cf450044 --- /dev/null +++ b/win/asm/socket.h @@ -0,0 +1,78 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _ASM_SOCKET_H +#define _ASM_SOCKET_H + +#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ + +#define _IO(x,y) (IOC_VOID|(x<<8)|y) +#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) + +#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */ +#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */ +#define FIONBIO 0x8004667e /* To be compatible with termiost version */ +#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */ +#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */ + +/* Needed for if queries */ +#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */ +#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */ +#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */ +#define SIOCGIFBRDADDR _IOW('s', 103, struct ifreq) /* Get if broadcastaddr */ +#define SIOCGIFNETMASK _IOW('s', 104, struct ifreq) /* Get if netmask */ +#define SIOCGIFHWADDR _IOW('s', 105, struct ifreq) /* Get hw addr */ +#define SIOCGIFMETRIC _IOW('s', 106, struct ifreq) /* get metric */ +#define SIOCGIFMTU _IOW('s', 107, struct ifreq) /* get MTU size */ + +#define SOL_SOCKET 0xffff /* options for socket level */ + +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_DONTLINGER (u_int)(~SO_LINGER) + +/* + * Additional options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +#endif /* _ASM_SOCKET_H */ + diff --git a/win/bootstrap.cpp b/win/bootstrap.cpp new file mode 100644 index 000000000..9f24f315c --- /dev/null +++ b/win/bootstrap.cpp @@ -0,0 +1,135 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include + +#include "qeventloopex.h" + +QEventLoopEx* qeventloopex = 0; + +/** + Actions to perform at very early stage of KDE application life on MS Windows. + Currently not much is performed here but later, who knows... + + Additional algorithm for win9x (including Millenium), where are problems with + easy setting environment variables: + + - try to find HOME env. variable + - if not found, try to find USERPROFILE env. variable + - if not found, try to find both HOMEDRIVE and HOMEPATH env. variables + - if not found, try in the Windows Registry: + - try get 'Software\KDE' value from HKEY_CURRENT_USER section of Windows Registry + - if not found, try to get from + 'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\AppData' + - if one of above two found, put the value as HOME environment variable + using putenv() function. + + Once HOME variable is set, Qt handles it well. +*/ +KDEWIN32_EXPORT void kde_bootstrap() +{ + OSVERSIONINFOA osver; + osver.dwOSVersionInfoSize = sizeof(osver); + DWORD rc = GetVersionExA( &osver ); + + WSADATA wsadata; + WSAStartup(MAKEWORD(2,2),&wsadata); + + qeventloopex = new QEventLoopEx(); + + //for win9x only: + if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + //set $HOME if not available + char *s, *s2; + s = getenv("HOME"); + if (!s) + s = getenv("USERPROFILE"); + if (!s) { + s = getenv("HOMEDRIVE"); + s2 = getenv("HOMEPATH"); + if (!s2) + s = 0; + } + if (!s) { + //no $HOME! : set a value from registry: + HKEY hKey; + DWORD len; + char path[1024]; + char path2[1024]; + bool ok; +#define KEY "Software\\KDE" + ok = (ERROR_SUCCESS == RegOpenKeyExA( HKEY_CURRENT_USER, KEY, 0, KEY_QUERY_VALUE, &hKey )); + if (ok) { + len = sizeof(path); + ok = (ERROR_SUCCESS == RegQueryValueExA( hKey, "HOME", 0, 0, (LPBYTE)path, &len )); + fprintf(stderr,"RegQueryValueExA = %d, %s\n", ok, path); + } +#define KEY2 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" + if (!ok) { + ok = (ERROR_SUCCESS == RegOpenKeyExA( HKEY_CURRENT_USER, KEY, 0, KEY_QUERY_VALUE, &hKey )); + if (ok) { + len = sizeof(path); + ok = (ERROR_SUCCESS == RegQueryValueExA( hKey, "AppData", 0, 0, (LPBYTE)path, &len )); + fprintf(stderr,"RegQueryValueExA = %d, %s\n", ok, path); + } + } + if (ok) { + ok = (0==access(path, R_OK)); + if (!ok) { + CreateDirectoryA(path,NULL); + ok = (0==access(path, R_OK)); + fprintf(stderr,"CreateDirectoryA(%s) = %d\n", path, ok); + } + + if (ok) { + //it's not a problem with encoding, because Qt will use fromLocal8Bit() + strcpy(path2, "HOME="); + strncat(path2, path, sizeof(path2)-1-strlen(path2)); + rc = putenv(path2); + fprintf(stderr,"putenv(HOME) = %d\n",(int)rc); +/* + path[0]=0; + char *p = getenv( "HOME" ); + fprintf(stderr,"getenv(HOME) = %s\n", p);*/ + } + else + fprintf(stderr,"'%s' doesn't exist\n",path); + } + else + fprintf(stderr,"$HOME not found!\n",path); + + RegCloseKey( hKey ); + } + } +} + +/** + Actions to perform after destroying KDE application on MS Windows. + + Currently, custom even loop (QEventLoopEx) is deleted here. +*/ +KDEWIN32_EXPORT void kde_destroy() +{ + delete qeventloopex; +} diff --git a/win/common.pro b/win/common.pro new file mode 100644 index 000000000..669d22d62 --- /dev/null +++ b/win/common.pro @@ -0,0 +1,198 @@ +# +# common.pro - Common definitions for KDElibs/win32 .pro files +# (c) 2003-2005, Jaroslaw Staniek, js@iidea.pl +# + +# to avoid a need for using Q_WS_WIN in C source code +DEFINES += _WINDOWS WIN32_LEAN_AND_MEAN + +# custom definitions, options on which KDElibs do not depend +exists( custom_defs.pro ) { + include( custom_defs.pro ) +} + +# common version info for all libs: +!contains( CONFIG, kde3lib ) { + VER_MAJ = $(KDE_VER_MAJ) + VER_MIN = $(KDE_VER_MIN) + VER_PAT = $(KDE_VER_PAT) +} + +CONFIG += qt thread warn_on +isEmpty( KW_CONFIG ) { + KW_CONFIG += debug + #KW_CONFIG += release + #KW_CONFIG += windows + KW_CONFIG += console +} + +# release switch has priority over debug +contains(KW_CONFIG,release) { + CONFIG -= debug + CONFIG += release +} +contains(KW_CONFIG,debug) { + CONFIG += debug + CONFIG -= release +} +contains(KW_CONFIG,windows) { + CONFIG += windows + CONFIG -= console +} +contains(KW_CONFIG,console) { + CONFIG -= windows + CONFIG += console +} + +# global binary destination directory +isEmpty( KDEBINDESTDIR ) { + KDEBINDESTDIR = $(KDEDIR) +} + +# global library destination directory +KDELIBDESTDIR = $$KDEBINDESTDIR\bin #shared with all binaries +###KDELIBDESTDIR = $$KDEBINDESTDIR\lib + +# dlls suffixes for given target +isEmpty( KDEBUG ) { + contains(CONFIG,debug) { + KDEBUG=_d + KDELIBDEBUG=_d + KDELIBDEBUGLIB=_d.lib + } + !contains(CONFIG,debug) { + KDEBUG=_ + contains(CONFIG,kde3lib) { + KDELIBDEBUG= + } + !contains(CONFIG,kde3lib) { + KDELIBDEBUG=_ + } + KDELIBDEBUGLIB=.lib + } +} +KDELIB_SUFFIX=$$KDEBUG$(KDE_VER).lib + +contains( TEMPLATE, app ) { + # default dest dir for "app" +# contains(CONFIG,debug) { + DESTDIR = $$KDEBINDESTDIR\bin +# } +# !contains(CONFIG,debug) { +# DESTDIR = $$KDEBINDESTDIR\release-bin +# } + !contains(CONFIG,nokdecore) { + LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + } + !contains(CONFIG,nokdeui) { + LIBS += $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX + } + !contains(CONFIG,nokdefx) { + LIBS += $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX + } +} +# default template is "lib" +isEmpty( TEMPLATE ) { + TEMPLATE = lib +} +contains( TEMPLATE, lib ) { + CONFIG += dll + + # indicate that we building a library + QMAKE_CXXFLAGS += -DKDE_MAKE_LIB=1 + + # lib/kde3 dest dir (for modules) + contains( CONFIG, kde3lib ) { + DESTDIR = $$KDEBINDESTDIR/lib/kde3 + TARGET_EXT = .dll #- no ver. in filename + } + !contains( CONFIG, kde3lib ) { + DESTDIR = $$KDELIBDESTDIR + } + contains( CONFIG, kstyle ) { + DESTDIR = $$KDEBINDESTDIR/lib/kde3/plugins/styles + CONFIG += plugin + } +# !contains(CONFIG,debug) { +# DESTDIR = $$KDEBINDESTDIR\release-lib +# } + + VERSION = $(KDE_VER_MAJ).$(KDE_VER_MIN).$(KDE_VER_PAT) +# VER_MAJ = $(KDE_VER_MAJ) +# VER_MIN = $(KDE_VER_MIN) +# VER_PAT = $(KDE_VER_PAT) +} + +# win32 dependent lib +!contains( DEFINES, MAKE_KDEWIN32_LIB ) { + LIBS += $$KDELIBDESTDIR/kdewin32$$KDELIB_SUFFIX +} + +# libltdl: +!contains( DEFINES, MAKE_LTDL_LIB ) { + !contains( DEFINES, MAKE_KDEWIN32_LIB ) { + LIBS += $$KDELIBDESTDIR/ltdl$$KDELIB_SUFFIX + DEFINES += LIBLTDL_DLL_IMPORT + } +} + +!contains( DEFINES, QT_DLL) { + DEFINES += QT_DLL +} + +# global definitions +win32-borland { + QMAKE_CXXFLAGS += /I $(KDELIBS)/win/kdelibs_global_win.h + QMAKE_CFLAGS += /I $(KDELIBS)/win/kdelibs_global_win.h +} +win32-msvc* { + QMAKE_CXXFLAGS += /FI$(KDELIBS)/win/kdelibs_global_win.h + QMAKE_CFLAGS += /FI$(KDELIBS)/win/kdelibs_global_win.h + + # Language Extensions + QMAKE_CXXFLAGS += /Ze +} + +# enable Run-Time Type Information (needed by dynamic_cast) +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_RTTI_ON # /GR for msvc + +# enables synchronous exception +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_EXCEPTIONS_ON # /GX for msvc + +# catch Release-Build Errors in Debug Build +#DISABLED for msvc.net +#contains( CONFIG, debug ) { +# contains( KW_CONFIG, debug ) { +# QMAKE_CXXFLAGS += /GZ +# } +#} + +# create an output file whether or not LINK finds an undefined symbol +# (warning 4006 will be raised instead of error): +QMAKE_LFLAGS += /FORCE:MULTIPLE + +# Specify that filename is a C++ source file, even if it doesn’t have +# a .cpp or .cxx extension, thus .cc files are compiled properly with msvc +QMAKE_CXXFLAGS += /TP + +INCLUDEPATH += moc $(KDELIBS)/win $(KDELIBS) + +contains(KW_CONFIG,release) { +OBJECTS_DIR = obj_rel +} +!contains(KW_CONFIG,release) { +OBJECTS_DIR = obj +} + +MOC_DIR = moc + +# enable this to temporary add debug info! +# CONFIG += debug +# CONFIG -= release + +!contains(CONFIG,debug) { +QMAKE_LFLAGS += /NODEFAULTLIB:MSVCRTD /NODEFAULTLIB:MSVCR71D /NODEFAULTLIB:MSVCP71D +} +contains(CONFIG,debug) { +QMAKE_LFLAGS += /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCR71 /NODEFAULTLIB:MSVCP71 /NODEFAULTLIB:libc +} diff --git a/win/config.h b/win/config.h new file mode 100644 index 000000000..9d6f25e4b --- /dev/null +++ b/win/config.h @@ -0,0 +1,54 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* config.h: definitions hardcoded for win32 target */ + +#ifndef _KDE_WIN_CONFIG_H_ +#define _KDE_WIN_CONFIG_H_ + +#include + +#ifndef HAVE_LIMITS_H +#define HAVE_LIMITS_H 1 +#endif + +#ifndef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H 1 +#endif + +#ifndef HAVE_SYS_TIME_H +#define HAVE_SYS_TIME_H 1 +#endif + +/*#define KDEDIR "F:\\KDE" TODO */ + +#define KDELIBSUFF "" + +#ifdef __cplusplus +extern "C" { +#endif + +KDECORE_EXPORT int mkstemps (char* _template, int suffix_len); +KDECORE_EXPORT char* mkdtemp (char* _template); + +#ifdef __cplusplus +} +#endif + +#endif /* _KDE_WIN_CONFIG_H_ */ diff --git a/win/ctype.h b/win/ctype.h new file mode 100644 index 000000000..3a0f54bfc --- /dev/null +++ b/win/ctype.h @@ -0,0 +1,37 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDEWIN_CTYPE_H +#define KDEWIN_CTYPE_H + +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + +#ifdef __cplusplus +inline int KDE_isspace(int c) { return ((unsigned)(c + 1) <= 256) && isspace(c); } +#else +#define KDE_isspace(__c) (((unsigned)(__c + 1) <= 256) && isspace(__c)) +#endif + +#define isspace KDE_isspace + +#endif /* KDEWIN_CTYPE_H */ diff --git a/win/dirent.h b/win/dirent.h new file mode 100644 index 000000000..2a4edf4c8 --- /dev/null +++ b/win/dirent.h @@ -0,0 +1,93 @@ +/* This file is part of the KDE project + Copyright (C) 2000 Werner Almesberger + + libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include + +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */ +#define HAVE_DD_LOCK /* have locking mechanism */ + +#define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */ + +#define __dirfd(dir) (dir)->dd_fd + +/* struct dirent - same as Unix */ +struct dirent { + long d_ino; /* inode (always 1 in WIN32) */ + off_t d_off; /* offset to this dirent */ + unsigned short d_reclen; /* length of d_name */ + char d_name[_MAX_FNAME+1]; /* filename (null terminated) */ +}; + +/* typedef DIR - not the same as Unix */ +typedef struct { + long handle; /* _findfirst/_findnext handle */ + short offset; /* offset into directory */ + short finished; /* 1 if there are not more files */ + struct _finddata_t fileinfo; /* from _findfirst/_findnext */ + char *dir; /* the dir we are reading */ + struct dirent dent; /* the dirent to return */ +} DIR; + +/* --- redundant --- */ + +//DIR *opendir(const char *); +//struct dirent *readdir(DIR *); +//void rewinddir(DIR *); +//int closedir(DIR *); + +/* internal prototype */ +void _seekdir(DIR *dir,off_t offset); + +//#ifndef _POSIX_SOURCE +//long telldir (DIR *); +//void seekdir (DIR *, off_t loc); + +KDEWIN32_EXPORT int scandir (const char *__dir, + struct dirent ***__namelist, + int (*select) (const struct dirent *), + int (*compar) (const struct dirent **, const struct dirent **)); + +KDEWIN32_EXPORT DIR * opendir(const char *); +KDEWIN32_EXPORT int closedir(DIR *); +KDEWIN32_EXPORT struct dirent* readdir(DIR *); +KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); + +int alphasort (const struct dirent **__a, const struct dirent **__b); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/win/dummy.cpp b/win/dummy.cpp new file mode 100644 index 000000000..e5e6473f6 --- /dev/null +++ b/win/dummy.cpp @@ -0,0 +1,34 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +/** + qt_enter_modal() and qt_enter_modal() from qapplication_win.cpp are not exported + by default, then we can't use it in NetAccess::enter_loop() (kio). + Empty implementation created as a workaround. +*/ +KDEWIN32_EXPORT void qt_enter_modal( QWidget *widget ) +{ +} + +KDEWIN32_EXPORT void qt_leave_modal( QWidget *widget ) +{ +} + diff --git a/win/fcntl.c b/win/fcntl.c new file mode 100644 index 000000000..b6b37c440 --- /dev/null +++ b/win/fcntl.c @@ -0,0 +1,27 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "fcntl.h" + +KDEWIN32_EXPORT int fcntl (int fd, int cmd,...) +{ + /*! @todo */ + return -1; +} + diff --git a/win/fcntl.h b/win/fcntl.h new file mode 100644 index 000000000..ba098c3ab --- /dev/null +++ b/win/fcntl.h @@ -0,0 +1,97 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _FCNTL_H +#define _FCNTL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define O_NDELAY _FNDELAY + +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define O_NONBLOCK _FNONBLOCK + +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ + +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* XXX close on exec request; must match UF_EXCLOSE in user.h */ +#define FD_CLOEXEC 1 /* posix */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ + +#ifndef _POSIX_SOURCE +# define F_GETOWN 5 /* Get owner - for ASYNC */ +# define F_SETOWN 6 /* Set owner - for ASYNC */ +#endif /* !_POSIX_SOURCE */ + +#define F_GETLK 7 /* Get record-locking information */ +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ + +#ifndef _POSIX_SOURCE +# define F_RGETLK 10 /* Test a remote lock to see if it is blocked */ +# define F_RSETLK 11 /* Set or unlock a remote lock */ +# define F_CNVT 12 /* Convert a fhandle to an open fd */ +# define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ +#endif /* !_POSIX_SOURCE */ + +/* fcntl(2) flags (l_type field of flock structure) */ +#define F_RDLCK 1 /* read lock */ +#define F_WRLCK 2 /* write lock */ +#define F_UNLCK 3 /* remove lock(s) */ + +#ifndef _POSIX_SOURCE +# define F_UNLKSYS 4 /* remove remote locks for a given system */ +#endif /* !_POSIX_SOURCE */ + +int KDEWIN32_EXPORT __cdecl fcntl (int fd, int cmd,...); + +#ifdef __cplusplus +} +#endif + +#endif /* _FCNTL_H */ + diff --git a/win/fsync.c b/win/fsync.c new file mode 100644 index 000000000..786c32d9d --- /dev/null +++ b/win/fsync.c @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +KDEWIN32_EXPORT int fsync(int fd) +{ + HANDLE h; + if (fd < 0) + return -1; + h = (HANDLE)_get_osfhandle(fd); + if ((int)h == -1) + return -1; + if (!FlushFileBuffers(h)) + return -1; + return 0; +} + diff --git a/win/getenv.c b/win/getenv.c new file mode 100644 index 000000000..22822c5ad --- /dev/null +++ b/win/getenv.c @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +KDEWIN32_EXPORT char * kde_getenv(const char *name) +{ + char dummy[1]; + int len; + char *p; + if (!name) + return 0; + len = GetEnvironmentVariableA(name, dummy, 0); + if (len == 0) + return 0; + + len++; + p = malloc(len); + if (GetEnvironmentVariableA(name, p, len)) + return p; + + free(p); + return 0; +} + diff --git a/win/grp.c b/win/grp.c new file mode 100644 index 000000000..7ed320b23 --- /dev/null +++ b/win/grp.c @@ -0,0 +1,46 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "grp.h" + +/* these functions always fail. for win32 */ + +KDEWIN32_EXPORT struct group *getgrnam (const char *name) +{ + return 0; +} + +KDEWIN32_EXPORT struct group *getgrgid (gid_t gid) +{ + return 0; +} + +KDEWIN32_EXPORT struct group *getgrent(void) +{ + return 0; +} + +KDEWIN32_EXPORT void setgrent(void) +{ +} + +KDEWIN32_EXPORT void endgrent(void) +{ +} + diff --git a/win/grp.h b/win/grp.h new file mode 100644 index 000000000..fc5de8662 --- /dev/null +++ b/win/grp.h @@ -0,0 +1,47 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef GRP_H_ +#define GRP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +KDEWIN32_EXPORT struct group *getgrnam (const char *name); +KDEWIN32_EXPORT struct group *getgrgid (gid_t gid); +KDEWIN32_EXPORT struct group *getgrent(void); +KDEWIN32_EXPORT void setgrent(void); +KDEWIN32_EXPORT void endgrent(void); + +#ifdef __cplusplus +} +#endif + +#endif /* GRP_H_ */ + diff --git a/win/in.h b/win/in.h new file mode 100644 index 000000000..6a8114586 --- /dev/null +++ b/win/in.h @@ -0,0 +1,184 @@ +/* This file is part of the KDE project + * Copyright (C) The GNU Project Team, + * Fred N. van Kempen, + + * Original taken from the GNU Project file. + + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions of the Internet Protocol. + * + * Version: @(#)in.h 1.0.1 04/21/93 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _IN_H +#define _IN_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Standard well-defined IP protocols. */ +enum +{ + IPPROTO_IP = 0, /* Dummy protocol for TCP */ + IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ + IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */ + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ + IPPROTO_TCP = 6, /* Transmission Control Protocol */ + IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ + IPPROTO_PUP = 12, /* PUP protocol */ + IPPROTO_UDP = 17, /* User Datagram Protocol */ + IPPROTO_IDP = 22, /* XNS IDP protocol */ + + IPPROTO_RAW = 255, /* Raw IP packets */ + IPPROTO_MAX +}; + +typedef unsigned short in_port_t; +//typedef uint16_t in_port_t; +/* Standard well-known ports. *//* from winsup/include/netinet/in.h */ +enum +{ + IPPORT_ECHO = 7, /* Echo service. */ + IPPORT_DISCARD = 9, /* Discard transmissions service. */ + IPPORT_SYSTAT = 11, /* System status service. */ + IPPORT_DAYTIME = 13, /* Time of day service. */ + IPPORT_NETSTAT = 15, /* Network status service. */ + IPPORT_FTP = 21, /* File Transfer Protocol. */ + IPPORT_TELNET = 23, /* Telnet protocol. */ + IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ + IPPORT_TIMESERVER = 37, /* Timeserver service. */ + IPPORT_NAMESERVER = 42, /* Domain Name Service. */ + IPPORT_WHOIS = 43, /* Internet Whois service. */ + IPPORT_MTP = 57, + + IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ + IPPORT_RJE = 77, + IPPORT_FINGER = 79, /* Finger service. */ + IPPORT_TTYLINK = 87, + IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ + + + IPPORT_EXECSERVER = 512, /* execd service. */ + IPPORT_LOGINSERVER = 513, /* rlogind service. */ + IPPORT_CMDSERVER = 514, + IPPORT_EFSSERVER = 520, + + /* UDP ports. */ + IPPORT_BIFFUDP = 512, + IPPORT_WHOSERVER = 513, + IPPORT_ROUTESERVER = 520, + + /* Ports less than this value are reserved for privileged processes. */ + IPPORT_RESERVED = 1024, + + /* Ports greater this value are reserved for (non-privileged) servers. */ + IPPORT_USERRESERVED = 5000 +}; + +typedef unsigned int in_addr_t; +//typedef uint32_t in_addr_t; + +/* Internet address. */ +struct in_addr +{ + unsigned int s_addr; +}; + +/* Request struct for multicast socket ops */ + +struct ip_mreq +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + + +/* Structure describing an Internet (IP) socket address. */ +#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ +struct sockaddr_in +{ + short int sin_family; /* Address family */ + unsigned short int sin_port; /* Port number */ + struct in_addr sin_addr; /* Internet address */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) + - sizeof(unsigned short int) - sizeof(struct in_addr)]; +}; + +#define sin_zero __pad /* for BSD UNIX comp. -FvK */ + +/* + * Definitions of the bits in an Internet address integer. + * On subnets, host and network parts are found according + * to the subnet mask, not these masks. + */ +#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) + +#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_MULTICAST_NET 0xF0000000 + +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) + +/* Address to accept any incoming messages. */ +#define INADDR_ANY ((unsigned long int) 0x00000000) + +/* Address to send to all hosts. */ +#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) + +/* Address indicating an error return. */ +#define INADDR_NONE 0xffffffff + +/* Network number for local host loopback. */ +#define IN_LOOPBACKNET 127 + +/* Address to loopback in software to local host. */ +#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ +#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) + +/* Defines for Multicast INADDR */ +#define INADDR_UNSPEC_GROUP 0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ff /* 224.0.0.255 */ + + +/* Some random defines to make it easier in the kernel.. */ +#ifdef __KERNEL__ + +#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) +#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) + +#endif + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/win/kde_file_win.c b/win/kde_file_win.c new file mode 100644 index 000000000..269f0fab6 --- /dev/null +++ b/win/kde_file_win.c @@ -0,0 +1,139 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "kde_file_win.h" + +KDEWIN32_EXPORT int kdewin32_stat(const char *file_name, struct stat *buf) +{ + char fixed_file_name[4]; + char *fixed_file_name2; + int len, result; + len = strlen(file_name); + if ((len==2 || len==3) && file_name[1]==':' && isalpha(file_name[0])) { + /* 1) */ + if (len==3) + return stat(file_name, buf); + strncpy(fixed_file_name, file_name, len); + fixed_file_name[2]='\\'; + fixed_file_name[3]=0; + return stat(fixed_file_name, buf); + } + if (len>1 && (file_name[len-1]=='\\' || file_name[len-1]=='/')) { + /* 2) */ + fixed_file_name2 = strndup(file_name, len); + fixed_file_name2[len-1]=0; + result = stat(fixed_file_name2, buf); + free(fixed_file_name2); + return result; + } +//TODO: is stat("/") ok? + return stat(file_name, buf); +} + +KDEWIN32_EXPORT int kdewin32_lstat(const char *file_name, struct stat *buf) +{ + return kdewin32_stat(file_name, buf); +} + +/** @internal */ +int kdewin32_fix_flags(int flags) +{ + if ((flags & O_TEXT) == 0 && (flags & O_BINARY) == 0) + return flags | O_BINARY; + return flags; +} + +/*KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags) +{ + return open(path, kdewin32_fix_flags(flags)); +}*/ + +KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags, ... /*mode_t mode*/) +{ + mode_t mode = 0; + if (flags & O_CREAT) { + va_list list; + va_start(list, flags); + mode = (mode_t)va_arg(list, int); + va_end(list); + } + return open(path, kdewin32_fix_flags(flags), mode); +} + +/** @internal */ +int kdewin32_fix_mode_string(char *fixed_mode, const char *mode) +{ + if (strlen(mode)<1 || strlen(mode)>3) + return 1; + + strncpy(fixed_mode, mode, 3); + if (fixed_mode[0]=='b' || fixed_mode[1]=='b' || fixed_mode[0]=='t' || fixed_mode[1]=='t') + return 0; + /* no 't' or 'b': append 'b' */ + if (fixed_mode[1]=='+') { + fixed_mode[1]='b'; + fixed_mode[2]='+'; + fixed_mode[3]=0; + } + else { + fixed_mode[1]='b'; + fixed_mode[2]=0; + } + return 0; +} + +KDEWIN32_EXPORT FILE *kdewin32_fopen(const char *path, const char *mode) +{ + char fixed_mode[4]; + if (0!=kdewin32_fix_mode_string(fixed_mode, mode)) + return 0; + return fopen(path, fixed_mode); +} + +KDEWIN32_EXPORT FILE *kdewin32_fdopen(int fd, const char *mode) +{ + char fixed_mode[4]; + if (0!=kdewin32_fix_mode_string(fixed_mode, mode)) + return 0; + return fdopen(fd, fixed_mode); +} + +KDEWIN32_EXPORT FILE *kdewin32_freopen(const char *path, const char *mode, FILE *stream) +{ + char fixed_mode[4]; + if (0!=kdewin32_fix_mode_string(fixed_mode, mode)) + return 0; + return freopen(path, fixed_mode, stream); +} + +KDEWIN32_EXPORT int kdewin32_rename(const char *src, const char *dest) +{ + if (0==access(dest, 0/*exists*/) + && 0 != remove(dest)) + return -1; + return rename(src, dest); +} + +KDEWIN32_EXPORT int kdewin32_mkdir(const char *path, mode_t mode) +{ + return mkdir(path); +} diff --git a/win/kde_file_win.h b/win/kde_file_win.h new file mode 100644 index 000000000..ada37eec8 --- /dev/null +++ b/win/kde_file_win.h @@ -0,0 +1,84 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDE_FILE_WIN_H +#define KDE_FILE_WIN_H + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Works like ::stat() but also: + 1) if @path is like "C:", '\' is appended + 2) else, '/' or '\' trailing characters are removed from @file_name + */ +KDEWIN32_EXPORT int kdewin32_stat(const char *file_name, struct stat *buf); + +/** + Identical to kdewin32_stat() + */ +KDEWIN32_EXPORT int kdewin32_lstat(const char *file_name, struct stat *buf); + +/** + Works like ::open() but also: + - if @flags have not specified O_TEXT flag, O_BINARY flag is appended + (because on win32 O_TEXT mode is the default, not O_BINARY like on unix) + */ +KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags, ... /*mode_t mode*/); + +/*KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags);*/ + +/** + Works like ::fopen() but also: + - if @mode have specified neither "t" (text flag) or "b" (binary flag), + "b" (binary) flag is appended (or inserted before '+' character) + (because on win32 text mode is the default, not binary like on unix) + */ +KDEWIN32_EXPORT FILE *kdewin32_fopen(const char *path, const char *mode); + +KDEWIN32_EXPORT FILE *kdewin32_fdopen(int fd, const char *mode); + +KDEWIN32_EXPORT FILE *kdewin32_freopen(const char *path, const char *mode, FILE *stream); + +/** + Before calling ::rename(), tries to remove() it, is needed, + because win32 semantics doesn't allow files overwriting using ::rename(). +*/ +KDEWIN32_EXPORT int kdewin32_rename(const char *src, const char *dest); + +/** + A wrapped for ::mkdir() used by KDE_mkdir(). +*/ +KDEWIN32_EXPORT int kdewin32_mkdir(const char *path, mode_t mode); + +#ifdef __cplusplus +} +#endif + +#endif //KDE_FILE_WIN_H diff --git a/win/kdelibs_export_win.h b/win/kdelibs_export_win.h new file mode 100644 index 000000000..064cc6484 --- /dev/null +++ b/win/kdelibs_export_win.h @@ -0,0 +1,152 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include /* to avoid #includes */ + +#define KPATH_SEPARATOR ';' +#define popen _popen +#define pclose _pclose + +#define KDE_IMPORT __declspec(dllimport) + +#ifdef MAKE_KDECORE_LIB +# define KDECORE_EXPORT KDE_EXPORT +#else +# ifndef KDECORE_EXPORT +# define KDECORE_EXPORT KDE_IMPORT //for apps and other libs +# endif +#endif + +#ifdef MAKE_KDEWIN32_LIB +# define KDEWIN32_EXPORT KDE_EXPORT +#else +# define KDEWIN32_EXPORT KDE_IMPORT +#endif + +/* some classes, i.e. KDock* already use EXPORT_* macro: define it too */ +#ifdef MAKE_KDEUI_LIB +# define KDEUI_EXPORT KDE_EXPORT +# define EXPORT_DOCKCLASS KDE_EXPORT +#elif KDE_MAKE_LIB +# define KDEUI_EXPORT KDE_IMPORT +# define EXPORT_DOCKCLASS KDE_IMPORT /* for library build export docklass by default */ +#else +# define KDEUI_EXPORT +# define EXPORT_DOCKCLASS +#endif + +#ifdef MAKE_KDEFX_LIB +# define KDEFX_EXPORT KDE_EXPORT +#else +# define KDEFX_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KDEPRINT_LIB +# define KDEPRINT_EXPORT KDE_EXPORT +#else +# define KDEPRINT_EXPORT KDE_IMPORT +#endif + +#ifndef KIO_EXPORT +# ifdef MAKE_KIO_LIB +# define KIO_EXPORT KDE_EXPORT +# else +# define KIO_EXPORT KDE_IMPORT +# endif +#endif + +#ifdef MAKE_DCOP_LIB +# define DCOP_EXPORT KDE_EXPORT +#else +# define DCOP_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KPARTS_LIB +# define KPARTS_EXPORT KDE_EXPORT +#else +# define KPARTS_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KTEXTEDITOR_LIB +# define KTEXTEDITOR_EXPORT KDE_EXPORT +#else +# define KTEXTEDITOR_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KABC_LIB +# define KABC_EXPORT KDE_EXPORT +#else +# define KABC_EXPORT KDE_IMPORT +#endif + + +#ifdef MAKE_KVCARD_LIB +# define KVCARD_EXPORT KDE_EXPORT +#else +# define KVCARD_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KRESOURCES_LIB +# define KRESOURCES_EXPORT KDE_EXPORT +#else +# define KRESOURCES_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KDESU_LIB +# define KDESU_EXPORT KDE_EXPORT +#else +# define KDESU_EXPORT KDE_IMPORT +#endif + +// all KStyle libs +#ifdef MAKE_KSTYLE_LIB +# define KSTYLE_EXPORT KDE_EXPORT +#else +# define KSTYLE_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KMDI_LIB +# define KMDI_EXPORT KDE_EXPORT +#else +# define KMDI_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KUTILS_LIB +# define KUTILS_EXPORT KDE_EXPORT +#else +# define KUTILS_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KATEPARTINTERFACES_LIB +# define KATEPARTINTERFACES_EXPORT KDE_EXPORT +#else +# define KATEPARTINTERFACES_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KATEPART_LIB +# define KATEPART_EXPORT KDE_EXPORT +#else +# define KATEPART_EXPORT KDE_IMPORT +#endif + +#ifdef MAKE_KHTML_LIB +# define KHTML_EXPORT KDE_EXPORT +#else +# define KHTML_EXPORT KDE_IMPORT +#endif diff --git a/win/kdelibs_global_win.h b/win/kdelibs_global_win.h new file mode 100644 index 000000000..aa095857a --- /dev/null +++ b/win/kdelibs_global_win.h @@ -0,0 +1,200 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2005 Jaroslaw Staniek + + Global definitions for KDElibs/win32 (win32) + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +/*! Bootstrap */ +#define kdemain \ +kde_start(int argc, char **argv); \ +__declspec(dllimport) void kde_bootstrap(); \ +__declspec(dllimport) void kde_destroy(); \ +int main(int argc, char **argv) \ +{ kde_bootstrap(); const int retcode = kde_start(argc, argv); kde_destroy(); return retcode; } \ +int kde_start + + +#ifndef WIN32 +# define WIN32 +#endif + +#ifndef HAVE_CONFIG_H +# define HAVE_CONFIG_H 1 +#endif + +#ifndef HAVE_STRING_H +# define HAVE_STRING_H 1 +#endif + +#ifndef HAVE_SYS_STAT_H +# define HAVE_SYS_STAT_H 1 +#endif + +#ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +#endif + +#define KDE_DISTRIBUTION_TEXT "KDE Libraries for MS Windows" +#define KDE_COMPILING_OS "win32" +#ifdef _MSC_VER +# if _MSC_VER < 1300 +# define KDE_COMPILER_VERSION "MSVC++ 6.0" +# elif _MSC_VER <= 1300 +# define KDE_COMPILER_VERSION "MSVC++ 7.0" +# elif _MSC_VER <= 1310 +# define KDE_COMPILER_VERSION "MSVC++ 7.1" +# elif _MSC_VER <= 1400 +# define KDE_COMPILER_VERSION "MSVC++ 8.0" +# else 1400 +# define KDE_COMPILER_VERSION "MSVC++ >8.0" +# endif +#endif + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#ifndef NULL +# define NULL 0 +#endif + +/* +#ifdef __cplusplus +#include + +# ifndef KDEDIR +# define KDEDIR QString(KDEWIN32_DIR) +# endif +# ifndef __KDE_BINDIR +# define __KDE_BINDIR QString(KDEWIN32_DIR "/bin") +# endif +#endif +*/ + +# ifndef __pid_t_defined + //typedef __pid_t pid_t; + typedef unsigned int pid_t; +# define __pid_t_defined +# endif + +# ifndef __uid_t_defined +//typedef __uid_t uid_t; + typedef unsigned int __uid_t; + typedef __uid_t uid_t; +# define __uid_t_defined +# endif + +# ifndef __gid_t_defined +//typedef __uid_t uid_t; + typedef unsigned int __gid_t; + typedef __gid_t gid_t; +# define __gid_t_defined +# endif + + typedef char* caddr_t; + + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + + +/* should be in */ +typedef int mode_t; + +#if defined(_MSC_VER) + +# if (_MSC_VER <= 1200) + /* Force Conformance for For Loop Scope (/Zc:forScope) is only allowed for + MSVC++ version > 6.0 + -this option controls the scope of variables + defined as part of the For loop control statement. Traditionally, Microsoft + extended the scope of loop control variables defined in the loop control statement + beyond the scope of the loop. Such behavior violates the ANSI C/C++ standard + and may cause compiler errors when compiling ANSI C/C++ code with Microsoft C++. + Simple (dirty) macro trick to fix the compile problem for msvc6 + ( see http://q12.org/pipermail/ode/2003-January/002811.html + and http://support.microsoft.com/default.aspx?scid=kb;EN-US;167748 ) + */ +# define for if (0); else for +# endif + +//operator (char*) caused errors +//#define QT_NO_ASCII_CAST + +/* warning C4150: deletion of pointer to incomplete type 'type'; no destructor called + +The delete operator was called to delete the given type, which was +declared but not defined. The compiler was unable to find any destructors for the given type. +*/ +#pragma warning( disable: 4150 ) + + +/* warning C4521: qmultiple copy constructors specified +*/ +#pragma warning( disable: 4521 ) + +/* warning C4251: 'identifier' : class 'type' needs to have dll-interface + to be used by clients of class 'type2' +*/ +#pragma warning( disable: 4251 ) + +/* identifier was truncated to '255'.. */ +# pragma warning(disable: 4786) + +/* warning C4250: ...: inherits ... via dominanceidentifier */ +# pragma warning(disable: 4250) + +# pragma warning(disable: 4006) /*libxxx : warning LNK4006: + ".... already defined in kaction.obj; second definition ignored" */ + +/* disable C4100: unreferenced formal parameter */ +# pragma warning(disable: 4100) + +/* disable C4101: unreferenced local variable */ +# pragma warning(disable: 4101) + +/* disable C4189: local variable is initialized but not referenced */ +# pragma warning(disable: 4189) + +# if (_MSC_VER >= 1300) +/* disable C4288: nonstandard extension used : 'i' : loop control variable + declared in the for-loop is used outside the for-loop scope; + it conflicts with the declaration in the outer scope */ +# pragma warning(disable: 4288) + +/* disable 4996: warnings for deprecated symbols */ +# pragma warning(disable: 4996) +# endif + +#endif + +/*#if (_MSC_VER >= 1300) && (WINVER < 0x0500) +#ifdef __cplusplus +extern "C" { +#endif +*/ +/* VC7 or later, building with pre-VC7 runtime libraries */ +/*extern "C"*/ long _ftol( double ); /* defined by VC6 C libs */ +/*extern "C" KDEWIN32_EXPORT long _ftol2( double dblSource ); */ +/*#ifdef __cplusplus +inline long _cdecl _ftol2( double dblSource ) { return _ftol( dblSource ); } +} +#endif*/ + diff --git a/win/kdemacros.h b/win/kdemacros.h new file mode 100644 index 000000000..c8c017b02 --- /dev/null +++ b/win/kdemacros.h @@ -0,0 +1 @@ +#include diff --git a/win/limits.h b/win/limits.h new file mode 100644 index 000000000..6b20e12c8 --- /dev/null +++ b/win/limits.h @@ -0,0 +1,28 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KDEWIN_LIMITS_H_ +#define _KDEWIN_LIMITS_H_ + +#include "../include/limits.h" /* msvc */ + +#include "sys/param.h" + +#endif /* _KDEWIN_LIMITS_H_ */ + diff --git a/win/machine/types.h b/win/machine/types.h new file mode 100644 index 000000000..30aeb4307 --- /dev/null +++ b/win/machine/types.h @@ -0,0 +1,65 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +/* + * The following section is RTEMS specific and is needed to more + * closely match the types defined in the BSD machine/types.h. + * This is needed to let the RTEMS/BSD TCP/IP stack compile. + */ + +#if defined(__rtems__) +typedef signed long long int64_t; +#if defined( __h8300__) +typedef signed long int32_t; +#else +typedef signed int int32_t; +#endif +typedef signed short int16_t; +typedef signed char int8_t; + +typedef unsigned long long u_int64_t; +#if defined( __h8300__) +typedef unsigned long u_int32_t; +#else +typedef unsigned int u_int32_t; +#endif +typedef unsigned short u_int16_t; +typedef unsigned char u_int8_t; +#endif + +#define _CLOCK_T_ unsigned long /* clock() */ +#define _TIME_T_ long /* time() */ +#define _CLOCKID_T_ unsigned long +#define _TIMER_T_ unsigned long + +#ifndef _HAVE_SYSTYPES +typedef long int __off_t; +typedef int __pid_t; +#ifdef __GNUC__ +__extension__ typedef long long int __loff_t; +#else +typedef long int __loff_t; +#endif +#endif + +#endif /* _MACHTYPES_H_ */ + diff --git a/win/mmap.c b/win/mmap.c new file mode 100644 index 000000000..de2098196 --- /dev/null +++ b/win/mmap.c @@ -0,0 +1,152 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + These sources are based on ftp://g.oswego.edu/pub/misc/malloc.c + file by Doug Lea, released to the public domain. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +//#define WIN32_LEAN_AND_MEAN +#include + +#define MORECORE_FAILURE ((void*)(-1)) +#define MUNMAP_FAILURE (-1) + +#define USE_MALLOC_LOCK 1 + +/* Wait for spin lock */ +static int slwait (int *sl) { +#ifdef KDEWIN32_9x + /* TODO */ +#else + while (InterlockedCompareExchange ((LONG volatile*) sl, (LONG) 1, (LONG) 0) != 0) + Sleep (0); +#endif + return 0; +} + +/* Release spin lock */ +static int slrelease (int *sl) { + InterlockedExchange (sl, 0); + return 0; +} + +/* getpagesize for windows */ +static long getpagesize (void) +{ + static long g_pagesize = 0; + if (! g_pagesize) { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_pagesize = system_info.dwPageSize; + } + return g_pagesize; +} + +/* Spin lock for emulation code */ +static int g_sl; + +static long getregionsize (void) +{ + static long g_regionsize = 0; + if (! g_regionsize) { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_regionsize = system_info.dwAllocationGranularity; + } + return g_regionsize; +} + +//static void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) { +KDEWIN32_EXPORT void * mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset) +{ + static long g_pagesize; + static long g_regionsize; +#ifdef TRACE + printf ("mmap %d\n", length); +#endif +#if defined (USE_MALLOC_LOCK) + /* Wait for spin lock */ + slwait (&g_sl); +#endif + /* First time initialization */ + if (! g_pagesize) + g_pagesize = getpagesize (); + if (! g_regionsize) + g_regionsize = getregionsize (); + /* Assert preconditions */ + assert ((unsigned) start % g_regionsize == 0); + assert (length % g_pagesize == 0); + /* Allocate this */ + start = VirtualAlloc (start, length, + MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE); + if (! start) { + start = (void *) MORECORE_FAILURE; + goto mmap_exit; + } + /* Assert postconditions */ + assert ((unsigned) start % g_regionsize == 0); +#ifdef TRACE + printf ("Commit %p %d\n", start, length); +#endif +mmap_exit: +#if defined (USE_MALLOC_LOCK) + /* Release spin lock */ + slrelease (&g_sl); +#endif + return start; +} + +//static long munmap (void *ptr, long size) { +KDEWIN32_EXPORT int munmap(void *start, size_t length) +{ + static long g_pagesize; + static long g_regionsize; + int rc = MUNMAP_FAILURE; +#ifdef TRACE + printf ("munmap %p %d\n", start, length); +#endif +#if defined (USE_MALLOC_LOCK) + /* Wait for spin lock */ + slwait (&g_sl); +#endif + /* First time initialization */ + if (! g_pagesize) + g_pagesize = getpagesize (); + if (! g_regionsize) + g_regionsize = getregionsize (); + /* Assert preconditions */ + assert ((unsigned) start % g_regionsize == 0); + assert (length % g_pagesize == 0); + /* Free this */ + if (! VirtualFree (start, 0, + MEM_RELEASE)) + goto munmap_exit; + rc = 0; +#ifdef TRACE + printf ("Release %p %d\n", start, length); +#endif +munmap_exit: +#if defined (USE_MALLOC_LOCK) + /* Release spin lock */ + slrelease (&g_sl); +#endif + return rc; +} diff --git a/win/net.c b/win/net.c new file mode 100644 index 000000000..89c73b3ef --- /dev/null +++ b/win/net.c @@ -0,0 +1,47 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +KDEWIN32_EXPORT unsigned long int +htonl (unsigned long int x) +{ + return ((((x & 0x000000ffU) << 24) | + ((x & 0x0000ff00U) << 8) | + ((x & 0x00ff0000U) >> 8) | + ((x & 0xff000000U) >> 24))); +} + +KDEWIN32_EXPORT unsigned long int +ntohl (unsigned long int x) +{ + return htonl (x); +} + +KDEWIN32_EXPORT unsigned short +htons (unsigned short x) +{ + return ((((x & 0x000000ffU) << 8) | + ((x & 0x0000ff00U) >> 8))); +} + +KDEWIN32_EXPORT unsigned short +ntohs (unsigned short x) +{ + return htons (x); +} + diff --git a/win/netdb.h b/win/netdb.h new file mode 100644 index 000000000..9f7f56b29 --- /dev/null +++ b/win/netdb.h @@ -0,0 +1,21 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* empty for now, to avoid #ifdefs */ + diff --git a/win/netinet/in.h b/win/netinet/in.h new file mode 100644 index 000000000..bde4666fa --- /dev/null +++ b/win/netinet/in.h @@ -0,0 +1,33 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +#ifndef INCL_WINSOCK_API_PROTOTYPES +#define INCL_WINSOCK_API_PROTOTYPES 0 +#endif + +#undef INCL_WINSOCK_API_PROTOTYPES +#define INCL_WINSOCK_API_PROTOTYPES 1 //for ntohl(), etc. +#include + +#include /* htons(), etc. */ + +#endif diff --git a/win/pro_files/README.pro_files b/win/pro_files/README.pro_files new file mode 100644 index 000000000..2192750f3 --- /dev/null +++ b/win/pro_files/README.pro_files @@ -0,0 +1,14 @@ +kdelibs/win32 .pro files + +(c) 2003-2005, Jaroslaw Staniek + +Add this directory to your PATH. +Cygwin or (other bash replacement) required. + +Please copy .pro files to destination kdelibs/ +subdirectores using update_kdelibs_pro_files scipt. + +.pro files were copied here from kdelibs/ directory +using collect_kdelibs_pro_files scipt. + +Scripts are available in win/tools/. diff --git a/win/pro_files/dcop/KDE-ICE/KDE-ICE.pro b/win/pro_files/dcop/KDE-ICE/KDE-ICE.pro new file mode 100644 index 000000000..d74a769a8 --- /dev/null +++ b/win/pro_files/dcop/KDE-ICE/KDE-ICE.pro @@ -0,0 +1,37 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + +DEFINES += ICE_t TRANS_SERVER TRANS_CLIENT SOCKCONN TCPCONN ANSICPP + +TARGET = kdeice$$KDEBUG$(KDE_VER) + +system( bash kmoc ) + +DEF_FILE = kde-ice.def + +CONFIG += no_precompile_header console +CONFIG -= dll +CONFIG += staticlib + +SOURCES += iceauth.c \ + process.c \ + accept.c \ + authutil.c \ + connect.c \ + error.c \ + getauth.c \ + globals.c \ + listen.c \ + listenwk.c \ + locking.c \ + misc.c \ + ping.c \ + protosetup.c \ + register.c \ + replywait.c \ + setauth.c \ + shutdown.c \ + transport.c \ + watch.c + diff --git a/win/pro_files/dcop/client/client.pro b/win/pro_files/dcop/client/client.pro new file mode 100644 index 000000000..4df64db5b --- /dev/null +++ b/win/pro_files/dcop/client/client.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +#DEFINES += MAKE_DCOP_LIB + +DEFINES += KDECORE_EXPORT= + +TARGET = dcopclient + +#system( bash kmoc .. ) + +#INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES = dcopclient.c diff --git a/win/pro_files/dcop/client/dcop/dcop.pro b/win/pro_files/dcop/client/dcop/dcop.pro new file mode 100644 index 000000000..99911eedb --- /dev/null +++ b/win/pro_files/dcop/client/dcop/dcop.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +#DEFINES += MAKE_DCOP_LIB + +DEFINES += KDECORE_EXPORT= + +TARGET = dcop + +#system( bash kmoc .. ) + +#INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += ../dcop.cpp diff --git a/win/pro_files/dcop/client/dcopfind/dcopfind.pro b/win/pro_files/dcop/client/dcopfind/dcopfind.pro new file mode 100644 index 000000000..315dcf5a2 --- /dev/null +++ b/win/pro_files/dcop/client/dcopfind/dcopfind.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +#DEFINES += MAKE_DCOP_LIB + +DEFINES += KDECORE_EXPORT= + +TARGET = dcopfind + +#system( bash kmoc .. ) + +#INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += ../dcopfind.cpp diff --git a/win/pro_files/dcop/client/dcopref/dcopref.pro b/win/pro_files/dcop/client/dcopref/dcopref.pro new file mode 100644 index 000000000..13370884c --- /dev/null +++ b/win/pro_files/dcop/client/dcopref/dcopref.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +#DEFINES += MAKE_DCOP_LIB + +DEFINES += KDECORE_EXPORT= + +TARGET = dcopref + +#system( bash kmoc .. ) + +#INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += ../dcopref.c diff --git a/win/pro_files/dcop/dcop.pro b/win/pro_files/dcop/dcop.pro new file mode 100644 index 000000000..7758cbb7b --- /dev/null +++ b/win/pro_files/dcop/dcop.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_DCOP_LIB + +TARGET = dcop$$KDEBUG + +system( bash kmoc ) + +LIBS += $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX + +SOURCES = \ +dcopref.cpp \ +dcopobject.cpp \ +dcopclient.cpp \ +dcopstub.cpp + diff --git a/win/pro_files/dcop/dcopidl/dcopidl.pro b/win/pro_files/dcop/dcopidl/dcopidl.pro new file mode 100644 index 000000000..017bfa5c8 --- /dev/null +++ b/win/pro_files/dcop/dcopidl/dcopidl.pro @@ -0,0 +1,21 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX + +LIBS -= $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX + +TARGET = dcopidl + +DEFINES += YY_ALWAYS_INTERACTIVE + +SOURCES = \ +main.cpp \ +scanner.cc \ +yacc.cc + +HEADERS = diff --git a/win/pro_files/dcop/dcopidl2cpp/dcopidl2cpp.pro b/win/pro_files/dcop/dcopidl2cpp/dcopidl2cpp.pro new file mode 100644 index 000000000..af8cef771 --- /dev/null +++ b/win/pro_files/dcop/dcopidl2cpp/dcopidl2cpp.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +LIBS -= $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX + +TARGET = dcopidl2cpp + +#DEFINES += YY_ALWAYS_INTERACTIVE + +SOURCES = \ +main.cpp \ +skel.cpp \ +stubimpl.cpp \ +stub.cpp + +HEADERS = diff --git a/win/pro_files/dcop/dcopserver/dcopserver.pro b/win/pro_files/dcop/dcopserver/dcopserver.pro new file mode 100644 index 000000000..46c7b31e9 --- /dev/null +++ b/win/pro_files/dcop/dcopserver/dcopserver.pro @@ -0,0 +1,19 @@ +TEMPLATE = app + +# needed to export library classes: + +CONFIG += nokdecore nokdefx nokdeui +include( $(KDELIBS)/win/common.pro ) + +DEFINES += MAKE_DCOP_LIB + +TARGET = dcopserver + +system( bash kmoc .. ) + +INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX + +SOURCES += ../dcopserver.cpp \ + ../dcopsignals.cpp diff --git a/win/pro_files/dcop/dcopserver_shutdown/dcopserver_shutdown.pro b/win/pro_files/dcop/dcopserver_shutdown/dcopserver_shutdown.pro new file mode 100644 index 000000000..c08d3c192 --- /dev/null +++ b/win/pro_files/dcop/dcopserver_shutdown/dcopserver_shutdown.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +CONFIG += nokdecore nokdefx nokdeui +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_DCOP_LIB + +TARGET = dcopserver_shutdown + +system( bash kmoc .. ) + +INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX + +SOURCES = ../dcopserver_shutdown_win.cpp diff --git a/win/pro_files/dcop/iceauth/iceauth.pro b/win/pro_files/dcop/iceauth/iceauth.pro new file mode 100644 index 000000000..b5c2bdf3b --- /dev/null +++ b/win/pro_files/dcop/iceauth/iceauth.pro @@ -0,0 +1,16 @@ +TEMPLATE = app + +CONFIG += nokdecore nokdefx nokdeui +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: + +LIBS += $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX + +TARGET = iceauth + +SOURCES = \ +iceauth.c \ +process.c + +HEADERS = diff --git a/win/pro_files/dcop/testdcop/testdcop.pro b/win/pro_files/dcop/testdcop/testdcop.pro new file mode 100644 index 000000000..9876e2815 --- /dev/null +++ b/win/pro_files/dcop/testdcop/testdcop.pro @@ -0,0 +1,14 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +TARGET = testdcop +DESTDIR = . + +system( bash kmoc .. ) + +INCLUDEPATH += ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES = ../testdcop.cpp diff --git a/win/pro_files/dcop/tests/build_win.sh b/win/pro_files/dcop/tests/build_win.sh new file mode 100755 index 000000000..161bdf13f --- /dev/null +++ b/win/pro_files/dcop/tests/build_win.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +perl ./generate.pl < testcases || exit 1 + +qmake dcop_test.pro -o Makefile && $MAKE || exit 1 +qmake driver.pro -o Makefile && $MAKE || exit 1 diff --git a/win/pro_files/dcop/tests/dcop_test.pro b/win/pro_files/dcop/tests/dcop_test.pro new file mode 100644 index 000000000..4b390dd1d --- /dev/null +++ b/win/pro_files/dcop/tests/dcop_test.pro @@ -0,0 +1,15 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +TARGET = dcop_test +DESTDIR = . + +system( bash kmoc ) +system( bash kdcopidl ) + +INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += test.cpp test_skel.cpp test_stub.cpp diff --git a/win/pro_files/dcop/tests/driver.pro b/win/pro_files/dcop/tests/driver.pro new file mode 100644 index 000000000..215a8596e --- /dev/null +++ b/win/pro_files/dcop/tests/driver.pro @@ -0,0 +1,15 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +TARGET = driver +DESTDIR = . + +system( bash kmoc ) +system( bash kdcopidl ) + +INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += driver.cpp test_stub.cpp diff --git a/win/pro_files/dcop/tests/tests.pro b/win/pro_files/dcop/tests/tests.pro new file mode 100644 index 000000000..fd5d7cab5 --- /dev/null +++ b/win/pro_files/dcop/tests/tests.pro @@ -0,0 +1,31 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_DCOP_LIB + +TARGET = testdcop + +system( bash kmoc .. ) + +INCLUDEPATH += .. ../moc + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeice$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX + +SOURCES += ../testdcop.cpp + + + + + + + + + + + + + + + diff --git a/win/pro_files/interfaces/interfaces.pro b/win/pro_files/interfaces/interfaces.pro new file mode 100644 index 000000000..b766eec14 --- /dev/null +++ b/win/pro_files/interfaces/interfaces.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS += \ +ktexteditor diff --git a/win/pro_files/interfaces/ktexteditor/ktexteditor.pro b/win/pro_files/interfaces/ktexteditor/ktexteditor.pro new file mode 100644 index 000000000..45678e6ff --- /dev/null +++ b/win/pro_files/interfaces/ktexteditor/ktexteditor.pro @@ -0,0 +1,74 @@ +TEMPLATE = lib +DEFINES += MAKE_KTEXTEDITOR_LIB + +include( $(KDELIBS)/win/common.pro ) + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR\kparts$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\kio$$KDELIB_SUFFIX $$KDELIBDESTDIR\kabc$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\kdewin32$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/interfaces $(KDELIBS)/interfaces/ktexteditor \ + $(KDELIBS)/kabc + +TARGET = ktexteditor$$KDEBUG + +system( bash kmoc ) +system( bash kdcopidl ) + +SOURCES = \ + ktexteditor.cpp \ + editinterface.cpp editinterfaceext.cpp \ + clipboardinterface.cpp selectioninterface.cpp searchinterface.cpp \ + codecompletioninterface.cpp wordwrapinterface.cpp blockselectioninterface.cpp \ + configinterface.cpp cursorinterface.cpp dynwordwrapinterface.cpp \ + printinterface.cpp highlightinginterface.cpp markinterface.cpp \ + popupmenuinterface.cpp undointerface.cpp viewcursorinterface.cpp \ + editdcopinterface.cpp clipboarddcopinterface.cpp \ + selectiondcopinterface.cpp \ + searchdcopinterface.cpp markinterfaceextension.cpp \ + configinterfaceextension.cpp encodinginterface.cpp sessionconfiginterface.cpp \ + viewstatusmsginterface.cpp editorchooser.cpp \ + blockselectiondcopinterface.cpp documentinfo.cpp documentdcopinfo.cpp\ + encodingdcopinterface.cpp \ + printdcopinterface.cpp \ + undodcopinterface.cpp viewcursordcopinterface.cpp \ + viewstatusmsgdcopinterface.cpp \ + selectioninterfaceext.cpp \ + texthintinterface.cpp variableinterface.cpp \ + templateinterface.cpp + +# generated: +SOURCES += \ +selectionextdcopinterface_skel.cpp \ +viewstatusmsgdcopinterface_skel.cpp \ +viewcursordcopinterface_skel.cpp \ +undodcopinterface_skel.cpp \ +printdcopinterface_skel.cpp \ +encodingdcopinterface_skel.cpp \ +documentdcopinfo_skel.cpp \ +blockselectiondcopinterface_skel.cpp \ +searchdcopinterface_skel.cpp \ +selectiondcopinterface_skel.cpp \ +clipboarddcopinterface_skel.cpp \ +editdcopinterface_skel.cpp \ +\ +selectionextdcopinterface_stub.cpp \ +viewstatusmsgdcopinterface_stub.cpp \ +viewcursordcopinterface_stub.cpp \ +undodcopinterface_stub.cpp \ +printdcopinterface_stub.cpp \ +encodingdcopinterface_stub.cpp \ +documentdcopinfo_stub.cpp \ +blockselectiondcopinterface_stub.cpp \ +searchdcopinterface_stub.cpp \ +selectiondcopinterface_stub.cpp \ +clipboarddcopinterface_stub.cpp \ +editdcopinterface_stub.cpp + + +HEADERS = + +INTERFACES = \ +editorchooser_ui.ui diff --git a/win/pro_files/kabc/kabc.pro b/win/pro_files/kabc/kabc.pro new file mode 100644 index 000000000..d7826b319 --- /dev/null +++ b/win/pro_files/kabc/kabc.pro @@ -0,0 +1,40 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_KABC_LIB +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR\kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\kresources$$KDELIB_SUFFIX $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\kio$$KDELIB_SUFFIX $$KDELIBDESTDIR\kvcard$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/kabc/vcard/include $(KDELIBS)/kabc/vcard/include/generated \ + $(KDELIBS)/kabc/vcardparser + +system( bash kmoc ) +system( bash kdcopidl ) +system( cd scripts && perl.exe makeaddressee ) + +TARGET = kabc$$KDEBUG + +SOURCES = \ + address.cpp addressbook.cpp addressee.cpp addresseedialog.cpp agent.cpp \ + distributionlist.cpp distributionlistdialog.cpp distributionlisteditor.cpp \ + errorhandler.cpp field.cpp formatfactory.cpp geo.cpp key.cpp \ + phonenumber.cpp picture.cpp plugin.cpp resource.cpp \ + resourceselectdialog.cpp secrecy.cpp sound.cpp stdaddressbook.cpp \ + timezone.cpp vcard21parser.cpp vcardconverter.cpp vcardformat.cpp \ + vcardformatimpl.cpp vcardformatplugin.cpp ldifconverter.cpp addresslineedit.cpp \ + ldapclient.cpp addresseelist.cpp vcardtool.cpp addresseehelper.cpp \ + lock.cpp locknull.cpp ldif.cpp ldapurl.cpp ldapconfigwidget.cpp \ + sortmode.cpp \ +\ +vcardparser/vcard.cpp vcardparser/vcardline.cpp vcardparser/vcardparser.cpp + +HEADERS = + +generated: +SOURCES += \ +addresseehelper_skel.cpp \ +addresseehelper_stub.cpp + diff --git a/win/pro_files/kabc/vcard/vcard.pro b/win/pro_files/kabc/vcard/vcard.pro new file mode 100644 index 000000000..7ccf215bc --- /dev/null +++ b/win/pro_files/kabc/vcard/vcard.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_KVCARD_LIB + +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/kabc/vcard/include $(KDELIBS)/kabc/vcard/include/generated \ + $(KDELIBS)/kabc/vcardparser + +system( bash kmoc ) +system( bash kdcopidl ) + +TARGET = kvcard$$KDEBUG + +SOURCES = \ +vCard-all.cpp + +HEADERS = + diff --git a/win/pro_files/kate/interfaces/interfaces.pro b/win/pro_files/kate/interfaces/interfaces.pro new file mode 100644 index 000000000..e327fed37 --- /dev/null +++ b/win/pro_files/kate/interfaces/interfaces.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_KATEPARTINTERFACES_LIB + +TARGET = katepartinterfaces$$KDEBUG + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/ktexteditor$$KDELIB_SUFFIX $$KDELIBDESTDIR/kparts$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/ktexteditor$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/interfaces + +system( bash kmoc ) + +SOURCES = \ +katecmd.cpp \ +interfaces.cpp + +HEADERS = diff --git a/win/pro_files/kate/kate.pro b/win/pro_files/kate/kate.pro new file mode 100644 index 000000000..45fc6e36d --- /dev/null +++ b/win/pro_files/kate/kate.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs + +SUBDIRS += \ +interfaces \ +part + diff --git a/win/pro_files/kate/part/part.pro b/win/pro_files/kate/part/part.pro new file mode 100644 index 000000000..82a9aa046 --- /dev/null +++ b/win/pro_files/kate/part/part.pro @@ -0,0 +1,43 @@ +TEMPLATE = lib +CONFIG += kde3lib #this is a kde module library + +include( $(KDELIBS)/win/common.pro ) + +# needed to export library classes: +DEFINES += MAKE_KATEPART_LIB + +TARGET = katepart$$KDELIBDEBUG + +LIBS += $$KDELIBDESTDIR/katepartinterfaces$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/ktexteditor$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kutils$$KDELIB_SUFFIX $$KDELIBDESTDIR/kparts$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/interfaces $(KDELIBS)/interfaces/kregexpeditor \ + $(KDELIBS)/kutils $(KDELIBS)/kdeprint + +system( bash kmoc ) +system( bash kdcopidl ) + +SOURCES = \ + katesearch.cpp katebuffer.cpp katecmds.cpp \ + kateundo.cpp katecursor.cpp katedialogs.cpp katedocument.cpp \ + katefactory.cpp katehighlight.cpp katesyntaxdocument.cpp \ + katetextline.cpp kateview.cpp kateconfig.cpp kateviewhelpers.cpp \ + katecodecompletion.cpp katedocumenthelpers.cpp \ + katecodefoldinghelpers.cpp kateviewinternal.cpp katebookmarks.cpp \ + katefont.cpp katelinerange.cpp katesupercursor.cpp \ + katearbitraryhighlight.cpp katerenderer.cpp kateattribute.cpp \ + kateindentscriptabstracts.cpp \ + kateautoindent.cpp katefiletype.cpp kateschema.cpp \ + katetemplatehandler.cpp \ + kateprinter.cpp katespell.cpp + +#todo: katejscript.cpp + +HEADERS = + +# generated: +SOURCES += \ +katedocument_skel.cpp diff --git a/win/pro_files/kdecore/kconfig_compiler/kconfig_compiler.pro b/win/pro_files/kdecore/kconfig_compiler/kconfig_compiler.pro new file mode 100644 index 000000000..5b8272185 --- /dev/null +++ b/win/pro_files/kdecore/kconfig_compiler/kconfig_compiler.pro @@ -0,0 +1,18 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +TARGET = kconfig_compiler + +win32 { +#CONFIG -= console +#CONFIG += windows +} + +#system( bash kmoc ) + +SOURCES = kconfig_compiler.cpp + +HEADERS = + + diff --git a/win/pro_files/kdecore/kdecore.pro b/win/pro_files/kdecore/kdecore.pro new file mode 100644 index 000000000..183835a43 --- /dev/null +++ b/win/pro_files/kdecore/kdecore.pro @@ -0,0 +1,143 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) +# for kqiodevicegzip_p.cpp +include( $(KDELIBS)/win/zlib.pro ) + +# needed to export library classes: +DEFINES += MAKE_KDECORE_LIB + +LIBS += $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX \ + -lqassistantclient + +TARGET = kdecore$$KDEBUG + +INCLUDEPATH += $(KDELIBS)/libltdl $(KDELIBS)/kdecore/network + +system( bash kmoc ) +system( bash kdcopidl ) + +SOURCES += \ +fakes.c \ +kpixmapprovider.cpp \ +kpalette.cpp \ +kprocess.cpp \ +kprocio.cpp \ +kcrash.cpp \ +kallocator.cpp \ +knotifyclient.cpp \ +kcompletionbase.cpp \ +kcompletion.cpp \ +kmimesourcefactory.cpp \ +ksimpleconfig.cpp \ +libintl.cpp \ +kcatalogue.cpp \ +kcalendarsystem.cpp \ +kcalendarsystemfactory.cpp \ +kcalendarsystemgregorian.cpp \ +kcalendarsystemhebrew.cpp \ +kcalendarsystemhijri.cpp \ +kcalendarsystemjalali.cpp \ +kaboutdata.cpp \ +kstringhandler.cpp \ +kcmdlineargs.cpp \ +kurldrag.cpp \ +kurl.cpp \ +kidna.cpp \ +kstaticdeleter.cpp \ +kstandarddirs.cpp \ +kconfig.cpp \ +kconfigdialogmanager.cpp \ +kcharsets.cpp \ +kglobal.cpp \ +kdebug.cpp \ +ktempfile.cpp \ +ktempdir.cpp \ +ksavefile.cpp \ +kconfigbackend.cpp \ +kconfigbase.cpp \ +kconfigskeleton.cpp \ +klockfile.cpp \ +kstdaccel.cpp \ +kcheckaccelerators.cpp \ +kkeyserver_x11.cpp \ +kkeynative_x11.cpp \ +kaccelbase.cpp \ +kaccel.cpp \ +kaccelmanager.cpp \ +kshortcut.cpp \ +kshortcutmenu.cpp \ +kshortcutlist.cpp \ +kinstance.cpp \ +kdeversion.cpp \ +klocale.cpp \ +kicontheme.cpp \ +kiconloader.cpp \ +kiconeffect.cpp \ +kglobalsettings.cpp \ +kckey.cpp \ +kglobalaccel.cpp \ +kglobalaccel_win.cpp \ +kaccelaction.cpp \ +kuniqueapplication.cpp \ +ksycoca.cpp \ +ksycocadict.cpp \ +ksycocafactory.cpp \ +kapplication.cpp \ +kapplication_win.cpp \ +kappdcopiface.cpp \ +kprocctrl.cpp \ +kdesktopfile.cpp \ +kbufferedio.cpp \ +netsupp_win32.cpp \ +kasyncio.cpp \ +ksockaddr.cpp \ +kmdcodec.cpp \ +kdcoppropertyproxy.cpp \ +klibloader.cpp \ +kprotocolinfo_kdecore.cpp \ +../kio/kio/kprotocolinfo.cpp \ +kprotocolinfofactory.cpp \ +kmountpoint.cpp \ +kmacroexpander.cpp \ +kshell.cpp \ +kclipboard.cpp \ +kdebugdcopiface.cpp \ +krandomsequence.cpp \ +krfcdate.cpp \ +kmultipledrag.cpp \ +kipc.cpp \ +kuser.cpp \ +kaudioplayer.cpp \ +kvmallocator.cpp \ +kqiodevicegzip_p.cpp + +#network/kresolver.cpp \ +#network/kresolvermanager.cpp \ +#network/kreverseresolver.cpp \ +#network/ksocketaddress.cpp \ +#network/ksocketbase.cpp \ +#network/ksocketdevice.cpp \ +#network/ksockssocketdevice.cpp + +#kstartupinfo.cpp \ +#todo: kextsock.cpp \ +#todo: ksock.cpp \ +#todo: ksocks.cpp \ +#kpath.cpp \ + +# generated: +SOURCES += \ +kappdcopiface_stub.cpp \ +kappdcopiface_skel.cpp \ +ksycoca_stub.cpp \ +ksycoca_skel.cpp \ +kdebugdcopiface_stub.cpp \ +kdebugdcopiface_skel.cpp + + +exists( custom_kdecore.pro ) { + include( custom_kdecore.pro ) +} + +HEADERS = diff --git a/win/pro_files/kded/kded.pro b/win/pro_files/kded/kded.pro new file mode 100644 index 000000000..05f2455cc --- /dev/null +++ b/win/pro_files/kded/kded.pro @@ -0,0 +1,36 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + +LIBS += $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR\kio$$KDELIB_SUFFIX + +# icon +LIBS+=$(KDELIBS)/win/resources/kbuildsycoca.res + +INCLUDEPATH += $(KDELIBS)/kded + +system( bash kmoc ) + +!contains(CONFIG,GUI) { + !contains(KW_CONFIG,release) { + TARGET = kbuildsycoca_d + } + contains(KW_CONFIG,release) { + TARGET = kbuildsycoca + } +} + +SOURCES = \ +kbuildsycoca.cpp \ +kbuildimageiofactory.cpp \ +kbuildprotocolinfofactory.cpp \ +kbuildservicefactory.cpp \ +kbuildservicegroupfactory.cpp \ +kbuildservicetypefactory.cpp \ +kctimefactory.cpp \ +vfolder_menu.cpp + +HEADERS = + +TRANSLATIONS = kbuildsycoca_pl.ts + diff --git a/win/pro_files/kded/kded_rel.pro b/win/pro_files/kded/kded_rel.pro new file mode 100644 index 000000000..a878305ba --- /dev/null +++ b/win/pro_files/kded/kded_rel.pro @@ -0,0 +1,12 @@ +#release gui version + +QMAKE_CXXFLAGS += -DKBUILDSYCOCA_GUI + +!contains(KW_CONFIG,release) { + KW_CONFIG = debug windows + KDEBUG=_d +} + +include( "kded.pro" ) + +TARGET = kbuildsycocaw #gui version diff --git a/win/pro_files/kded/makeall.sh b/win/pro_files/kded/makeall.sh new file mode 100755 index 000000000..2a988fac5 --- /dev/null +++ b/win/pro_files/kded/makeall.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +qmake kded.pro && nmake -nologo clean && nmake -nologo || exit 1 +qmake kded_gui.pro && nmake -nologo clean && nmake -nologo || exit 1 diff --git a/win/pro_files/kded/makeall_rel.sh b/win/pro_files/kded/makeall_rel.sh new file mode 100755 index 000000000..c3dc42172 --- /dev/null +++ b/win/pro_files/kded/makeall_rel.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +qmake kded.pro KW_CONFIG=release -o Makefile.release && nmake -nologo -f Makefile.release clean && nmake -nologo -f Makefile.release || exit 1 +qmake kded_gui.pro KW_CONFIG=release -o Makefile.release && nmake -nologo -f Makefile.release clean && nmake -nologo -f Makefile.release || exit 1 diff --git a/win/pro_files/kdefx/kdefx.pro b/win/pro_files/kdefx/kdefx.pro new file mode 100644 index 000000000..6c9ba4a22 --- /dev/null +++ b/win/pro_files/kdefx/kdefx.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KDEFX_LIB + +TARGET = kdefx$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +kimageeffect.cpp \ +kpixmapeffect.cpp \ +kpixmapsplitter.cpp \ +kpixmap.cpp \ +kstyle.cpp \ +kdrawutil.cpp \ +kcpuinfo.cpp + +HEADERS = diff --git a/win/pro_files/kdefx/kdefx_rel.pro b/win/pro_files/kdefx/kdefx_rel.pro new file mode 100644 index 000000000..177836f03 --- /dev/null +++ b/win/pro_files/kdefx/kdefx_rel.pro @@ -0,0 +1,27 @@ +TEMPLATE = lib + +KW_CONFIG = release +CONFIG -= debug +CONFIG += release + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KDEFX_LIB + +system( moc kstyle.h -o moc/kstyle.moc ) + +LIBS -= "$(KDEDIR)\lib\kdewin32_$(KDE_VER).lib" "$(KDEDIR)\lib\ltdl_$(KDE_VER).lib" + +SOURCES = \ +kimageeffect.cpp \ +kpixmapeffect.cpp \ +kpixmap.cpp \ +kstyle.cpp \ +kdrawutil.cpp \ +kcpuinfo.cpp + +HEADERS = + +TARGET = kdefx diff --git a/win/pro_files/kdeprint/kdeprint.pro b/win/pro_files/kdeprint/kdeprint.pro new file mode 100644 index 000000000..c541548ae --- /dev/null +++ b/win/pro_files/kdeprint/kdeprint.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KDEPRINT_LIB + +TARGET = kdeprint$$KDEBUG + +SOURCES = \ +kprinter.cpp \ +kpreloadobject.cpp + +HEADERS = diff --git a/win/pro_files/kdeui/kdeui.pro b/win/pro_files/kdeui/kdeui.pro new file mode 100644 index 000000000..13404b3a8 --- /dev/null +++ b/win/pro_files/kdeui/kdeui.pro @@ -0,0 +1,148 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KDEUI_LIB + +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR\kdefx$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX + +system( bash kmoc ) +system( bash kdcopidl ) + +TARGET = kdeui$$KDEBUG + +SOURCES = \ +kaboutapplication.cpp \ +kaboutdialog.cpp \ +kaboutkde.cpp \ +kactionclasses.cpp \ +kactioncollection.cpp \ +kaction.cpp \ +kactionselector.cpp \ +kactivelabel.cpp \ +kanimwidget.cpp \ +karrowbutton.cpp \ +kauthicon.cpp \ +kbugreport.cpp \ +kbuttonbox.cpp \ +kcharselect.cpp \ +kcmenumngr.cpp \ +kcmodule.cpp \ +kcolorbutton.cpp \ +kcolorcombo.cpp \ +kcolordialog.cpp \ +kcolordrag.cpp \ +kcombobox.cpp \ +kcommand.cpp \ +kcompletionbox.cpp \ +kconfigdialog.cpp \ +kcursor.cpp \ +kdatepicker.cpp \ +kdatetbl.cpp \ +kdatewidget.cpp \ +kdialog.cpp \ +kdialogbase.cpp \ +kdockwidget.cpp \ +kdockwidget_private.cpp \ +kdualcolorbutton.cpp \ +keditcl1.cpp \ +keditcl2.cpp \ +keditlistbox.cpp \ +kedittoolbar.cpp \ +kfontcombo.cpp \ +kfontdialog.cpp \ +kfontrequester.cpp \ +kguiitem.cpp \ +khelpmenu.cpp \ +kiconview.cpp \ +kiconviewsearchline.cpp \ +kjanuswidget.cpp \ +kkeybutton.cpp \ +kkeydialog.cpp \ +klanguagebutton.cpp \ +kled.cpp \ +klineedit.cpp \ +klineeditdlg.cpp \ +klistbox.cpp \ +klistview.cpp \ +klistviewsearchline.cpp \ +kmainwindowiface.cpp \ +kmainwindow.cpp \ +kmenubar.cpp \ +knuminput.cpp \ +knumvalidator.cpp \ +kpanelapplet.cpp \ +kpanelappmenu.cpp \ +kpanelextension.cpp \ +kpanelmenu.cpp \ +kpassdlg.cpp \ +kpassivepopup.cpp \ +kpixmapio.cpp \ +kpixmapregionselectordialog.cpp \ +kpixmapregionselectorwidget.cpp \ +kpopupmenu.cpp \ +kprogress.cpp \ +kpushbutton.cpp \ +krestrictedline.cpp \ +krootpixmap.cpp \ +kruler.cpp \ +ksconfig.cpp \ +kselect.cpp \ +kseparator.cpp \ +kshortcutdialog.cpp \ +kspell.cpp \ +kspelldlg.cpp \ +ksplashscreen.cpp \ +ksqueezedtextlabel.cpp \ +kstatusbar.cpp \ +kstdaction.cpp \ +kstdguiitem.cpp \ +kstringvalidator.cpp \ +ksyntaxhighlighter.cpp \ +ksystemtray.cpp \ +ktabctl.cpp \ +ktextbrowser.cpp \ +ktextedit.cpp \ +ktip.cpp \ +ktoolbar.cpp \ +ktoolbarbutton.cpp \ +ktoolbarhandler.cpp \ +ktoolbarradiogroup.cpp \ +kurllabel.cpp \ +kwhatsthismanager.cpp \ +kwindowinfo.cpp \ +kwizard.cpp \ +kwordwrap.cpp \ +kxmlguibuilder.cpp \ +kxmlguiclient.cpp \ +kxmlguifactory.cpp \ +kxmlguifactory_p.cpp \ +kdcopactionproxy.cpp \ +ktabwidget.cpp \ +ktabbar.cpp \ +kdatetimewidget.cpp \ +ktimewidget.cpp \ +kinputdialog.cpp + +exists( kmessagebox_win.cpp ) { + #added KMessageBox::Dangerous implementation + SOURCES += kmessagebox_win.cpp +} +!exists( kmessagebox_win.cpp ) { + SOURCES += kmessagebox.cpp +} + +# generated: +SOURCES += \ +kmainwindowiface_stub.cpp \ +kmainwindowiface_skel.cpp + +FORMS = \ +kshortcutdialog_advanced.ui \ +kshortcutdialog_simple.ui \ +kspellui.ui + +HEADERS = diff --git a/win/pro_files/kdewidgets/kdewidgets.pro b/win/pro_files/kdewidgets/kdewidgets.pro new file mode 100644 index 000000000..1458bf323 --- /dev/null +++ b/win/pro_files/kdewidgets/kdewidgets.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +CONFIG += kde3lib #this is a dynamic kde library + +include( $(KDELIBS)/win/common.pro ) + +system( makekdewidgets -o kdewidgets.cpp kde.widgets ) + +#no _d because it's a special case + +TARGET = kdewidgets + +DESTDIR = $$KDELIBDESTDIR/kde3/plugins/designer + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kabc$$KDELIB_SUFFIX $$KDELIBDESTDIR/kutils$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kresources$$KDELIB_SUFFIX + +SOURCES += classpreviews.cpp kdewidgets.cpp + diff --git a/win/pro_files/kdewidgets/makekdewidgets.pro b/win/pro_files/kdewidgets/makekdewidgets.pro new file mode 100644 index 000000000..cc9c0786b --- /dev/null +++ b/win/pro_files/kdewidgets/makekdewidgets.pro @@ -0,0 +1,19 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + + +TARGET = makekdewidgets +DESTDIR = . + +win32 { +#CONFIG -= console +#CONFIG += windows +} + +SOURCES = makekdewidgets.cpp + +HEADERS = + + + diff --git a/win/pro_files/kio/kfile/tests/kfiletreeviewtest.pro b/win/pro_files/kio/kfile/tests/kfiletreeviewtest.pro new file mode 100644 index 000000000..da3cffa19 --- /dev/null +++ b/win/pro_files/kio/kfile/tests/kfiletreeviewtest.pro @@ -0,0 +1,29 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + + +#allow to select target independently from debug information +kdebase_release:CONFIG -= console +kdebase_release:CONFIG += windows +kdebase_release:QMAKE_MAKEFILE = Makefile.release + + +TARGET = kfiletreeviewtest + +LIBS += $$KDELIBDESTDIR/kdefx$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kparts$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX + +# icon +LIBS+=$(KDELIBS)/win/resources/kfind.res + +system( bash kmoc ) + +SOURCES = \ +kfiletreeviewtest.cpp + +HEADERS = + + diff --git a/win/pro_files/kio/kio.pro b/win/pro_files/kio/kio.pro new file mode 100644 index 000000000..6381bc387 --- /dev/null +++ b/win/pro_files/kio/kio.pro @@ -0,0 +1,212 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) +include( $(KDELIBS)/win/zlib.pro ) + +# needed to export library classes: +DEFINES += MAKE_KIO_LIB + +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR\kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR\kdewin32$$KDELIB_SUFFIX + +system( bash kmoc kio kfile misc bookmarks kssl ) + +TARGET = kio$$KDEBUG + +INCLUDEPATH += $(KDELIBS)/kdecore/network $(KDELIBS)/kio/kio $(KDELIBS)/kio/misc $(KDELIBS)/kio/bookmarks \ + $(KDELIBS)/kio/kssl \ + $(KDELIBS)/libltdl $(KDELIBS)/interfaces \ + $(KDELIBS)/kio/kio/moc $(KDELIBS)/kio/misc/moc $(KDELIBS)/kio/kfile/moc \ + $(KDELIBS)/kio/misc/moc \ + $(KDELIBS)/kio/bookmarks/moc \ + $(KDELIBS)/kio/kssl/moc $(KDELIBS)/kwallet/client + +system( cd kio && dcopidl kdirnotify.h > kdirnotify.kidl && dcopidl2cpp --no-stub kdirnotify.kidl ) +system( cd kio && dcopidl observer.h > observer.kidl && dcopidl2cpp observer.kidl ) +system( cd bookmarks && dcopidl kbookmarknotifier.h > kbookmarknotifier.kidl && dcopidl2cpp kbookmarknotifier.kidl ) +system( cd bookmarks && dcopidl kbookmarkmanager.h > kbookmarkmanager.kidl && dcopidl2cpp kbookmarkmanager.kidl ) +system( cd misc && dcopidl uiserver.h > uiserver.kidl && dcopidl2cpp uiserver.kidl ) + + +SOURCES = \ +kio/authinfo.cpp \ +kio/chmodjob.cpp \ +kio/connection.cpp \ +kio/dataprotocol.cpp \ +kio/dataslave.cpp \ +kio/davjob.cpp \ +kio/defaultprogress.cpp \ +kio/global.cpp \ +kio/job.cpp \ +kio/kacl.cpp \ +kio/kar.cpp \ +kio/karchive.cpp \ +kio/kdatatool.cpp \ +kio/kdcopservicestarter.cpp \ +kio/kdirlister.cpp \ +kio/kdirnotify.cpp \ +kio/kdirwatch.cpp \ +kio/kemailsettings.cpp \ +kio/kfilefilter.cpp \ +kio/kfileitem.cpp \ +kio/kfilemetainfo.cpp \ +kio/kfileshare.cpp \ +kio/kfilterbase.cpp \ +kio/kfilterdev.cpp \ +kio/kimageio.cpp \ +kio/kmimemagic.cpp \ +kio/kmimetype.cpp \ +kio/kmimetypechooser.cpp \ +kio/knfsshare.cpp \ +kio/kprotocolinfo.cpp \ +kio/kprotocolmanager.cpp \ +kio/kremoteencoding.cpp \ +kio/krun.cpp \ +kio/ksambashare.cpp \ +kio/kscan.cpp \ +kio/kservice.cpp \ +kio/kservicefactory.cpp \ +kio/kservicegroup.cpp \ +kio/kservicegroupfactory.cpp \ +kio/kservicetype.cpp \ +kio/kservicetypefactory.cpp \ +kio/kshellcompletion.cpp \ +kio/kshred.cpp \ +kio/ktar.cpp \ +kio/ktrader.cpp \ +kio/ktraderparse.cpp \ +kio/ktraderparsetree.cpp \ +kio/kurifilter.cpp \ +kio/kurlcompletion.cpp \ +kio/kurlpixmapprovider.cpp \ +kio/kuserprofile.cpp \ +kio/kzip.cpp \ +kio/lex.c \ +kio/metainfojob.cpp \ +kio/netaccess.cpp \ +kio/observer.cpp \ +kio/passdlg.cpp \ +kio/paste.cpp \ +kio/pastedialog.cpp \ +kio/previewjob.cpp \ +kio/progressbase.cpp \ +kio/renamedlg.cpp \ +kio/scheduler.cpp \ +kio/sessiondata.cpp \ +kio/skipdlg.cpp \ +kio/slave.cpp \ +kio/slavebase.cpp \ +kio/slaveconfig.cpp \ +kio/slaveinterface.cpp \ +kio/statusbarprogress.cpp \ +kio/tcpslavebase.cpp \ +kio/yacc.c \ +\ +bookmarks/kbookmark.cc \ +bookmarks/kbookmarkbar.cc \ +bookmarks/kbookmarkdombuilder.cc \ +bookmarks/kbookmarkdrag.cc \ +bookmarks/kbookmarkexporter.cc \ +bookmarks/kbookmarkimporter.cc \ +bookmarks/kbookmarkimporter_crash.cc \ +bookmarks/kbookmarkimporter_ie.cc \ +bookmarks/kbookmarkimporter_kde1.cc \ +bookmarks/kbookmarkimporter_ns.cc \ +bookmarks/kbookmarkimporter_opera.cc \ +bookmarks/kbookmarkmanager.cc \ +bookmarks/kbookmarkmenu.cc \ +\ +kfile/kcombiview.cpp \ +kfile/kcustommenueditor.cpp \ +kfile/kdiroperator.cpp \ +kfile/kdirselectdialog.cpp \ +kfile/kdirsize.cpp \ +kfile/kdiskfreesp.cpp \ +kfile/kencodingfiledialog.cpp \ +kfile/kfilebookmarkhandler.cpp \ +kfile/kfiledetailview.cpp \ +kfile/kfiledialog.cpp \ +kfile/kfilefiltercombo.cpp \ +kfile/kfileiconview.cpp \ +kfile/kfilemetainfowidget.cpp \ +kfile/kfilemetapreview.cpp \ +kfile/kfilepreview.cpp \ +kfile/kfilesharedlg.cpp \ +kfile/kfilespeedbar.cpp \ +kfile/kfiletreebranch.cpp \ +kfile/kfiletreeview.cpp \ +kfile/kfiletreeviewitem.cpp \ +kfile/kfileview.cpp \ +kfile/kicondialog.cpp \ +kfile/kimagefilepreview.cpp \ +kfile/kmetaprops.cpp \ +kfile/knotifydialog.cpp \ +kfile/kopenwith.cpp \ +kfile/kpreviewprops.cpp \ +kfile/kpreviewwidgetbase.cpp \ +kfile/kpropertiesdialog.cpp \ +kfile/krecentdirs.cpp \ +kfile/krecentdocument.cpp \ +kfile/kurlbar.cpp \ +kfile/kurlcombobox.cpp \ +kfile/kurlrequester.cpp \ +kfile/kurlrequesterdlg.cpp \ +\ +misc/uiserver.cpp \ +\ +kssl/ksslcertdlg.cc \ +kssl/ksslinfodlg.cc \ +kssl/ksslcsessioncache.cc \ +kssl/ksslsession.cc \ +kssl/ksslsettings.cc \ +kssl/ksslcertchain.cc \ +kssl/ksslcertificate.cc \ +kssl/ksslcertificatecache.cc \ +kssl/ksslcertificatehome.cc \ +kssl/ksslcertificatefactory.cc \ +kssl/kssl.cc \ +kssl/ksslconnectioninfo.cc \ +kssl/ksslkeygen.cc \ +kssl/ksslpkcs7.cc \ +kssl/ksslpkcs12.cc \ +kssl/ksslx509v3.cc \ +kssl/ksslx509map.cc \ +kssl/ksslsigners.cc \ +kssl/ksslpeerinfo.cc \ +kssl/kopenssl.cc \ +kssl/ksmimecrypto.cc + +#removed kio/kautomount.cpp \ + +SOURCES += \ +../kdecore/kprotocolinfo_kdecore.cpp + +# js 2004-08-05 ^^^^^ a hack because msvc cannot split a class between two libraries! + +#kprotocolinfofactory.cpp \ + +#slavebase.cpp \ + +# generated: +SOURCES += \ +kio/kdirnotify_stub.cpp \ +kio/kdirnotify_skel.cpp \ +kio/observer_stub.cpp \ +kio/observer_skel.cpp \ +\ +bookmarks/kbookmarknotifier_stub.cpp \ +bookmarks/kbookmarknotifier_skel.cpp \ +bookmarks/kbookmarkmanager_stub.cpp \ +bookmarks/kbookmarkmanager_skel.cpp \ +\ +misc/uiserver_stub.cpp \ +misc/uiserver_skel.cpp + + +FORMS = \ +kssl/keygenwizard.ui \ +kssl/keygenwizard2.ui \ +kfile/knotifywidgetbase.ui \ +kfile/kpropertiesdesktopadvbase.ui \ +kfile/kpropertiesdesktopbase.ui \ +kfile/kpropertiesmimetypebase.ui diff --git a/win/pro_files/kioslave/bzip2/bzip2.pro b/win/pro_files/kioslave/bzip2/bzip2.pro new file mode 100644 index 000000000..ba76a95a4 --- /dev/null +++ b/win/pro_files/kioslave/bzip2/bzip2.pro @@ -0,0 +1,10 @@ +include( ../common.pro ) + +INCLUDEPATH += $(KDELIBS)/win/3rdparty/bzip2 + +TARGET = kbzip2filter$$KDELIBDEBUG + +SOURCES = \ +kbzip2filter.cpp + +HEADERS = diff --git a/win/pro_files/kioslave/common.pro b/win/pro_files/kioslave/common.pro new file mode 100644 index 000000000..2bb1361f7 --- /dev/null +++ b/win/pro_files/kioslave/common.pro @@ -0,0 +1,8 @@ +TEMPLATE = lib + +CONFIG += kde3lib #this is a dynamic kde library + +include( $(KDELIBS)/win/common.pro ) + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX + diff --git a/win/pro_files/kioslave/gzip/gzip.pro b/win/pro_files/kioslave/gzip/gzip.pro new file mode 100644 index 000000000..fb09f18c3 --- /dev/null +++ b/win/pro_files/kioslave/gzip/gzip.pro @@ -0,0 +1,9 @@ +include( ../common.pro ) +include( $(KDELIBS)/win/zlib.pro ) + +TARGET = kgzipfilter$$KDELIBDEBUG + +SOURCES = \ +kgzipfilter.cpp + +HEADERS = diff --git a/win/pro_files/kioslave/kioslave.pro b/win/pro_files/kioslave/kioslave.pro new file mode 100644 index 000000000..a28199480 --- /dev/null +++ b/win/pro_files/kioslave/kioslave.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs + +SUBDIRS += \ +gzip \ +bzip2 + +#file \ +#ftp \ +#http \ +#metainfo + diff --git a/win/pro_files/kmdi/kmdi.pro b/win/pro_files/kmdi/kmdi.pro new file mode 100644 index 000000000..1f425b465 --- /dev/null +++ b/win/pro_files/kmdi/kmdi.pro @@ -0,0 +1,31 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KMDI_LIB + +TARGET = kmdi$$KDEBUG + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kutils$$KDELIB_SUFFIX $$KDELIBDESTDIR/kparts$$KDELIB_SUFFIX + +INCLUDEPATH += res $(KDELIBS)/kutils $(KDELIBS)/kdeui + +system( bash kmoc ) + +SOURCES = \ +kmdichildarea.cpp \ +kmdichildfrm.cpp \ +kmdichildfrmcaption.cpp \ +kmdichildview.cpp \ +kmdidockcontainer.cpp \ +kmdidocumentviewtabwidget.cpp \ +kmdifocuslist.cpp \ +kmdiguiclient.cpp \ +kmdimainfrm.cpp \ +kmditaskbar.cpp \ +kmditoolviewaccessor.cpp + +HEADERS = diff --git a/win/pro_files/kmdi/test/test.pro b/win/pro_files/kmdi/test/test.pro new file mode 100644 index 000000000..85216ebb0 --- /dev/null +++ b/win/pro_files/kmdi/test/test.pro @@ -0,0 +1,25 @@ +TEMPLATE = app +#CONFIG = qt warn_on thread + +include( $(KDELIBS)/win/common.pro ) + + +CONFIG -= release +CONFIG -= windows +CONFIG += debug +CONFIG += console + +unix:DEFINES = NO_INCLUDE_MOCFILES QT_NO_COMPAT +unix:LIBS += -lkmdi -L$(KDEDIR)/lib -lkdecore -lkdeui -lDCOP -lkparts +unix:INCLUDEPATH += . .. $(KDEDIR)/include + +LIBS += $$KDELIBDESTDIR\kmdi$$KDELIB_SUFFIX $$KDELIBDESTDIR\kparts$$KDELIB_SUFFIX + +HEADERS = hello.h \ + mainwidget.h + +SOURCES = hello.cpp \ + mainwidget.cpp \ + main.cpp + +TARGET = kfourchildren diff --git a/win/pro_files/kparts/kparts.pro b/win/pro_files/kparts/kparts.pro new file mode 100644 index 000000000..19b68a16b --- /dev/null +++ b/win/pro_files/kparts/kparts.pro @@ -0,0 +1,31 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KPARTS_LIB + +TARGET = kparts$$KDEBUG + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/kio/kfile + +system( bash kmoc ) + +SOURCES = \ +browserextension.cpp \ +browserinterface.cpp \ +browserrun.cpp \ +dockmainwindow.cpp \ +event.cpp \ +factory.cpp \ +historyprovider.cpp \ +mainwindow.cpp \ +part.cpp \ +partmanager.cpp \ +plugin.cpp \ +statusbarextension.cpp + diff --git a/win/pro_files/kresources/kresources.pro b/win/pro_files/kresources/kresources.pro new file mode 100644 index 000000000..d729b82ed --- /dev/null +++ b/win/pro_files/kresources/kresources.pro @@ -0,0 +1,35 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KRESOURCES_LIB + +INCLUDEPATH += $(KDELIBS)/ab + +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR\kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR\dcop$$KDELIB_SUFFIX $$KDELIBDESTDIR\kio$$KDELIB_SUFFIX + +system( bash kmoc ) +system( bash kdcopidl ) + +TARGET = kresources$$KDEBUG + +SOURCES = \ +configdialog.cpp \ +configpage.cpp \ +configwidget.cpp \ +factory.cpp \ +kcmkresources.cpp \ +managerimpl.cpp \ +resource.cpp \ +selectdialog.cpp \ +testresources.cpp + +generated: +SOURCES += \ +manageriface_skel.cpp \ +manageriface_stub.cpp + +HEADERS = diff --git a/win/pro_files/kstyles/activeheart/widget-engine/genembed.pro b/win/pro_files/kstyles/activeheart/widget-engine/genembed.pro new file mode 100644 index 000000000..21ab07a78 --- /dev/null +++ b/win/pro_files/kstyles/activeheart/widget-engine/genembed.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + + +win32 { + CONFIG +=console + CONIG -=windows +} + +DESTDIR=. +TARGET = genembed + +SOURCES = \ +genembed.cpp + + diff --git a/win/pro_files/kstyles/activeheart/widget-engine/widget-engine.pro b/win/pro_files/kstyles/activeheart/widget-engine/widget-engine.pro new file mode 100644 index 000000000..9245377cc --- /dev/null +++ b/win/pro_files/kstyles/activeheart/widget-engine/widget-engine.pro @@ -0,0 +1,17 @@ +include( ../../common.pro ) + +system( bash kmoc ) +system( qmake genembed.pro -o Makefile.genembed ) +system( nmake /f Makefile.genembed clean ) +system( nmake /f Makefile.genembed ) +system( bash ./genemb.sh ) + +TARGET = activeheart$$KDEBUG + +SOURCES = \ +colorutil.cpp \ +gradients.cpp \ +activeheart.cpp \ +pixmaploader.cpp + + diff --git a/win/pro_files/kstyles/common.pro b/win/pro_files/kstyles/common.pro new file mode 100644 index 000000000..d76111c37 --- /dev/null +++ b/win/pro_files/kstyles/common.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib + +CONFIG += kstyle + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KSTYLE_LIB + +LIBS += $$KDELIBDESTDIR\kdefx$$KDELIB_SUFFIX + diff --git a/win/pro_files/kstyles/dotNET/dotnet/dotnet.pro b/win/pro_files/kstyles/dotNET/dotnet/dotnet.pro new file mode 100644 index 000000000..d9ca9d8c3 --- /dev/null +++ b/win/pro_files/kstyles/dotNET/dotnet/dotnet.pro @@ -0,0 +1,10 @@ +include( ../../common.pro ) + +TARGET = dotnet$$KDEBUG + +SOURCES = \ +dotnet.cpp + +system( moc dotnet.h -o moc/dotnet.moc ) + + diff --git a/win/pro_files/kstyles/highcolor/highcolor.pro b/win/pro_files/kstyles/highcolor/highcolor.pro new file mode 100644 index 000000000..57bfca812 --- /dev/null +++ b/win/pro_files/kstyles/highcolor/highcolor.pro @@ -0,0 +1,10 @@ +include( ../common.pro ) + +TARGET = highcolor$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +highcolor.cpp + + diff --git a/win/pro_files/kstyles/keramik/genembed.pro b/win/pro_files/kstyles/keramik/genembed.pro new file mode 100644 index 000000000..21ab07a78 --- /dev/null +++ b/win/pro_files/kstyles/keramik/genembed.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + + +win32 { + CONFIG +=console + CONIG -=windows +} + +DESTDIR=. +TARGET = genembed + +SOURCES = \ +genembed.cpp + + diff --git a/win/pro_files/kstyles/keramik/keramik.pro b/win/pro_files/kstyles/keramik/keramik.pro new file mode 100644 index 000000000..42094301c --- /dev/null +++ b/win/pro_files/kstyles/keramik/keramik.pro @@ -0,0 +1,14 @@ +include( ../common.pro ) + +TARGET = keramik$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +colorutil.cpp \ +gradients.cpp \ +keramik.cpp \ +pixmaploader.cpp + +system( bash ./genemb.sh ) + diff --git a/win/pro_files/kstyles/klegacy/klegacy.pro b/win/pro_files/kstyles/klegacy/klegacy.pro new file mode 100644 index 000000000..1f280202c --- /dev/null +++ b/win/pro_files/kstyles/klegacy/klegacy.pro @@ -0,0 +1,8 @@ +include( ../common.pro ) + +TARGET = klegacy$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +klegacystyle.cpp diff --git a/win/pro_files/kstyles/kstyles.pro b/win/pro_files/kstyles/kstyles.pro new file mode 100644 index 000000000..c556acfaa --- /dev/null +++ b/win/pro_files/kstyles/kstyles.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs + +SUBDIRS += \ +activeheart/widget-engine \ +plastik \ +highcolor \ +keramik \ +light \ +slickerstyle/slicker \ +dotNET/dotnet \ +thinkeramik/widget-engine diff --git a/win/pro_files/kstyles/kthemestyle/themestyle.pro b/win/pro_files/kstyles/kthemestyle/themestyle.pro new file mode 100644 index 000000000..773030b6b --- /dev/null +++ b/win/pro_files/kstyles/kthemestyle/themestyle.pro @@ -0,0 +1,15 @@ +include( ../common.pro ) + +LIBS += $$KDELIBDESTDIR\kdecore$$KDELIB_SUFFIX + +TARGET = kthemestyle$$KDEBUG + +SOURCES = \ +kthemestyle.cpp \ +kthemebase.cpp \ +kstyledirs.cpp + +system( moc kthemestyle.h -o moc/kthemestyle.moc ) +system( moc kthemebase.h -o moc/kthemebase.moc ) + + diff --git a/win/pro_files/kstyles/light/light.pro b/win/pro_files/kstyles/light/light.pro new file mode 100644 index 000000000..025158c3a --- /dev/null +++ b/win/pro_files/kstyles/light/light.pro @@ -0,0 +1,11 @@ +include( ../common.pro ) + +TARGET = light$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +light.cpp \ +lightstyle-v2.cpp \ +lightstyle-v3.cpp + diff --git a/win/pro_files/kstyles/plastik/plastik.pro b/win/pro_files/kstyles/plastik/plastik.pro new file mode 100644 index 000000000..51937369c --- /dev/null +++ b/win/pro_files/kstyles/plastik/plastik.pro @@ -0,0 +1,9 @@ +include( ../common.pro ) + +TARGET = plastik$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +plastik.cpp \ +misc.cpp diff --git a/win/pro_files/kstyles/slickerstyle/slicker/slicker.pro b/win/pro_files/kstyles/slickerstyle/slicker/slicker.pro new file mode 100644 index 000000000..0f7bab178 --- /dev/null +++ b/win/pro_files/kstyles/slickerstyle/slicker/slicker.pro @@ -0,0 +1,8 @@ +include( ../../common.pro ) + +TARGET = slicker$$KDEBUG + +system( bash kmoc ) + +SOURCES = \ +slicker.cpp \ No newline at end of file diff --git a/win/pro_files/kstyles/thinkeramik/widget-engine/genembed.pro b/win/pro_files/kstyles/thinkeramik/widget-engine/genembed.pro new file mode 100644 index 000000000..37e637ed7 --- /dev/null +++ b/win/pro_files/kstyles/thinkeramik/widget-engine/genembed.pro @@ -0,0 +1,26 @@ +TEMPLATE = app + +include( $(KDELIBS)/win/common.pro ) + + +unix:LIBS += -lkdefx + +win32 { + CONFIG +=console + CONIG -=windows +} + +DESTDIR=. + + +contains( KW_CONFIG, release ) { +TARGET = genembed_rel +} +!contains( KW_CONFIG, release ) { +TARGET = genembed +} + +SOURCES = \ +genembed.cpp + + diff --git a/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro b/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro new file mode 100644 index 000000000..66346be7d --- /dev/null +++ b/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro @@ -0,0 +1,50 @@ +# release version with compiled-in kdefx classes +# this is used eg. for QT-only apps like Installer + +TEMPLATE = lib + +unix { + INCLUDEPATH += moc + #force finding libraries in current dir (for installer, etc): + QMAKE_LFLAGS += -Wl,-rpath,. + DEFINES += KDEFX_EXPORT= +} + + +CONFIG += kstyle + +KW_CONFIG = release +CONFIG -= debug +CONFIG += release + +include( $(KDELIBS)/win/common.pro ) + + +LIBS= #DONT BE DEPENDENT ON ANY OTHER LIBS + +CONFIG -= debug + +# needed to export library classes: +DEFINES += MAKE_KSTYLE_LIB MAKE_KDEFX_LIB + +TARGET = thinkeramik + +SOURCES = \ +colorutil.cpp \ +gradients.cpp \ +thinkeramik.cpp \ +pixmaploader.cpp + +#compile in kdefx +SOURCES += \ +../../../kdefx/kstyle.cpp \ +../../../kdefx/kimageeffect.cpp \ +../../../kdefx/kpixmapeffect.cpp \ +../../../kdefx/kpixmap.cpp + +system( moc thinkeramik.h -o moc/thinkeramik.moc ) +system( moc ../../../kdefx/kstyle.h -o moc/kstyle.moc ) + + +system( bash ./genemb.sh ) + diff --git a/win/pro_files/kstyles/thinkeramik/widget-engine/widget-engine.pro b/win/pro_files/kstyles/thinkeramik/widget-engine/widget-engine.pro new file mode 100644 index 000000000..41181415f --- /dev/null +++ b/win/pro_files/kstyles/thinkeramik/widget-engine/widget-engine.pro @@ -0,0 +1,26 @@ +include( ../../common.pro ) + +TARGET = thinkeramik$$KDEBUG + +unix { + INCLUDEPATH += moc + #force finding libraries in current dir (for installer, etc): + QMAKE_LFLAGS += -Wl,-rpath,. +} + +system( bash kmoc ) + +SOURCES = \ +colorutil.cpp \ +gradients.cpp \ +thinkeramik.cpp \ +pixmaploader.cpp + +contains( KW_CONFIG, release ) { + system( bash ./genemb.sh _rel ) +} + +!contains( KW_CONFIG, release ) { + system( bash ./genemb.sh ) +} + diff --git a/win/pro_files/kutils/kutils.pro b/win/pro_files/kutils/kutils.pro new file mode 100644 index 000000000..5f07d4673 --- /dev/null +++ b/win/pro_files/kutils/kutils.pro @@ -0,0 +1,26 @@ +TEMPLATE = lib + +include( $(KDELIBS)/win/common.pro ) + + +# needed to export library classes: +DEFINES += MAKE_KUTILS_LIB + +TARGET = kutils$$KDEBUG + +LIBS += $$KDELIBDESTDIR/kdecore$$KDELIB_SUFFIX $$KDELIBDESTDIR/kdeui$$KDELIB_SUFFIX \ + $$KDELIBDESTDIR/kio$$KDELIB_SUFFIX + +INCLUDEPATH += $(KDELIBS)/interfaces/kregexpeditor + +system( bash kmoc ) + +SOURCES = \ +kfind.cpp \ +kfinddialog.cpp \ +kmultitabbar.cpp \ +kplugininfo.cpp \ +kreplace.cpp \ +kreplacedialog.cpp + +HEADERS = diff --git a/win/pro_files/libltdl/libltdl.pro b/win/pro_files/libltdl/libltdl.pro new file mode 100644 index 000000000..b4385d70b --- /dev/null +++ b/win/pro_files/libltdl/libltdl.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib + +DEFINES += MAKE_LTDL_LIB +DEFINES += DLL_EXPORT HAVE_STRING_H=1 HAVE_STDLIB_H=1 HAVE_STDIO_H=1 HAVE_MALLOC_H=1 HAVE_CTYPE_H=1 +DEFINES += LTDL_OBJDIR=\".libs/\" + +include( $(KDELIBS)/win/common.pro ) + + +TARGET = ltdl$$KDEBUG + + +SOURCES = \ +ltdl.c \ +ltdl_win.c + +HEADERS = \ +ltdl.h \ +ltdl_win.h diff --git a/win/pwd.c b/win/pwd.c new file mode 100644 index 000000000..fb402bdc7 --- /dev/null +++ b/win/pwd.c @@ -0,0 +1,53 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include + +/* these functions always fail for win32 */ + +KDEWIN32_EXPORT struct passwd * getpwnam (const char *name) +{ + return 0; +} + +KDEWIN32_EXPORT +struct passwd * getpwuid (uid_t uid) +{ + return 0; +} + +KDEWIN32_EXPORT +void setpwent (void) +{ +} + +KDEWIN32_EXPORT +struct passwd *getpwent() +{ + return 0; +} + +KDEWIN32_EXPORT +void endpwent() +{ +} + diff --git a/win/pwd.h b/win/pwd.h new file mode 100644 index 000000000..69aaf82a6 --- /dev/null +++ b/win/pwd.h @@ -0,0 +1,73 @@ +/* This file is part of the KDE project + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pwd.h 5.13 (Berkeley) 5/28/91 + */ + +#ifndef _PWD_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define _PWD_H_ + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + int pw_uid; /* user uid */ + int pw_gid; /* user gid */ + char *pw_comment; /* comment */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ +}; + +KDEWIN32_EXPORT struct passwd *getpwuid (uid_t); +KDEWIN32_EXPORT struct passwd *getpwnam (const char *); +KDEWIN32_EXPORT int getpwnam_r (const char *, struct passwd *, + char *, size_t , struct passwd **); +KDEWIN32_EXPORT int getpwuid_r (uid_t, struct passwd *, char *, + size_t, struct passwd **); + +KDEWIN32_EXPORT struct passwd *getpwent (void); +KDEWIN32_EXPORT void setpwent (void); +KDEWIN32_EXPORT void endpwent (void); + +#ifdef __cplusplus +} +#endif +#endif /* _PWD_H_ */ diff --git a/win/qeventloopex.cpp b/win/qeventloopex.cpp new file mode 100644 index 000000000..ae53d26f9 --- /dev/null +++ b/win/qeventloopex.cpp @@ -0,0 +1,552 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2005 Andreas Roth + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include "qeventloopex.h" + + +// Local defined structures and classes (needed only for QEventLoopEx implementation) +struct QSockNotEx +{ + QSocketNotifier *obj; + int fd; + fd_set *queue; +}; + +class QSockNotTypeEx +{ +public: + QSockNotTypeEx(); + ~QSockNotTypeEx(); + + QPtrList *list; + fd_set select_fds; + fd_set enabled_fds; + fd_set pending_fds; + +}; + +class QEventLoopExPrivate +{ +public: + QEventLoopExPrivate() + { + reset(); + } + + void reset() { + m_bStopped = false; + m_hThread = NULL; + m_sockUpdate = 0; + m_evPendingListEmpty = NULL; + sn_highest = 0; + } + bool m_bStopped; + + HANDLE m_hThread; + SOCKET m_sockUpdate; + + // pending socket notifiers list + QPtrList sn_pending_list; + HANDLE m_evPendingListEmpty; + CRITICAL_SECTION m_csPendingList; + + // highest fd for all socket notifiers + int sn_highest; + // 3 socket notifier types - read, write and exception + QSockNotTypeEx sn_vec[3]; + CRITICAL_SECTION m_csVec; +}; + + +/***************************************************************************** + Socket notifier type + *****************************************************************************/ +QSockNotTypeEx::QSockNotTypeEx() + : list( 0 ) +{ + FD_ZERO( &select_fds ); + FD_ZERO( &enabled_fds ); + FD_ZERO( &pending_fds ); +} + +QSockNotTypeEx::~QSockNotTypeEx() +{ + delete list; + list = 0; +} + +QEventLoopEx::QEventLoopEx( QObject *parent, const char *name) : + QEventLoop(parent,name) +{ + DWORD dwThreadId; + +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QEventLoopEx::QEventLoopEx enter"); +#endif + d = new QEventLoopExPrivate; + + InitializeCriticalSection(&d->m_csVec); + InitializeCriticalSection(&d->m_csPendingList); + + d->m_evPendingListEmpty = CreateEvent(NULL,TRUE,FALSE,NULL); + + d->m_sockUpdate = socket(AF_INET,SOCK_DGRAM,0); + d->m_hThread = CreateThread(NULL,0,ThreadProc,this,0,&dwThreadId); +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QEventLoopEx::QEventLoopEx leave"); +#endif +} + +QEventLoopEx::~QEventLoopEx() +{ +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QEventLoopEx::~QEventLoopEx enter"); +#endif + d->m_bStopped = true; + // Ensure that you thread gets unblocked and can terminate gracefully + SetEvent(d->m_evPendingListEmpty); + + closesocket(d->m_sockUpdate); + + WaitForSingleObject(d->m_hThread,INFINITE); + CloseHandle(d->m_hThread); + + CloseHandle(d->m_evPendingListEmpty); + DeleteCriticalSection(&d->m_csVec); + DeleteCriticalSection(&d->m_csPendingList); + + delete d; + +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QEventLoopEx::~QEventLoopEx leave"); +#endif +} + + + +/***************************************************************************** + QEventLoopEx implementations for Windows (for synchronous socket calls) + *****************************************************************************/ +void QEventLoopEx::registerSocketNotifier( QSocketNotifier *notifier ) +{ + int sockfd = notifier->socket(); + int type = notifier->type(); + u_long n; + DWORD dw; +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::registerSocketNotifier %p", notifier ); +#endif + if(ioctlsocket(sockfd,FIONREAD,&n) == SOCKET_ERROR) + { +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::registerSocketNotifier %p not a socket", notifier ); +#endif + dw = WSAGetLastError(); + QEventLoop::registerSocketNotifier(notifier); + return; + } + + if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) + { +#if defined(QT_CHECK_RANGE) + qWarning( "QSocketNotifier: Internal error" ); +#endif + return; + } + + EnterCriticalSection(&d->m_csVec); + + QPtrList *list = d->sn_vec[type].list; + fd_set *fds = &d->sn_vec[type].enabled_fds; + QSockNotEx *sn; + + if ( ! list ) { + // create new list, the QSockNotType destructor will delete it for us + list = new QPtrList; + Q_CHECK_PTR( list ); + list->setAutoDelete( TRUE ); + d->sn_vec[type].list = list; + } + + sn = new QSockNotEx; + Q_CHECK_PTR( sn ); + sn->obj = notifier; + sn->fd = sockfd; + sn->queue = &d->sn_vec[type].pending_fds; + + if ( list->isEmpty() ) { + list->insert( 0, sn ); + } else { // sort list by fd, decreasing + QSockNotEx *p = list->first(); + while ( p && p->fd > sockfd ) + p = list->next(); + if ( p ) + list->insert( list->at(), sn ); + else + list->append( sn ); + } + + FD_SET( sockfd, fds ); + + d->sn_highest = QMAX( d->sn_highest, sockfd ); + LeaveCriticalSection(&d->m_csVec); + +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::signal update socket"); +#endif + closesocket(d->m_sockUpdate); +} + +void QEventLoopEx::unregisterSocketNotifier( QSocketNotifier *notifier ) +{ + int sockfd = notifier->socket(); + int type = notifier->type(); + if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) { +#if defined(QT_CHECK_RANGE) + qWarning( "QSocketNotifier: Internal error" ); +#endif + return; + } +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::unregisterSocketNotifier %p", notifier ); +#endif + + EnterCriticalSection(&d->m_csVec); + QPtrList *list = d->sn_vec[type].list; + fd_set *fds = &d->sn_vec[type].enabled_fds; + QSockNotEx *sn; + if ( ! list ) { + LeaveCriticalSection(&d->m_csVec); + QEventLoop::unregisterSocketNotifier(notifier); + return; + } + sn = list->first(); + while ( sn && !(sn->obj == notifier && sn->fd == sockfd) ) + sn = list->next(); + if ( !sn ) {// not found + LeaveCriticalSection(&d->m_csVec); + QEventLoop::unregisterSocketNotifier(notifier); + return; + } + + FD_CLR( sockfd, fds ); // clear fd bit + FD_CLR( sockfd, sn->queue ); + + EnterCriticalSection(&d->m_csPendingList); + d->sn_pending_list.removeRef( sn ); // remove from activation list + bool bNowEmpty = (d->sn_pending_list.count() == 0); + LeaveCriticalSection(&d->m_csPendingList); + if(bNowEmpty) + SetEvent(d->m_evPendingListEmpty); + list->remove(); // remove notifier found above + + if ( d->sn_highest == sockfd ) {// find highest fd + d->sn_highest = -1; + for ( int i=0; i<3; i++ ) { + if ( d->sn_vec[i].list && ! d->sn_vec[i].list->isEmpty() ) + d->sn_highest = QMAX( d->sn_highest, // list is fd-sorted + d->sn_vec[i].list->getFirst()->fd ); + } + } + LeaveCriticalSection(&d->m_csVec); +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::signal update socket"); +#endif + closesocket(d->m_sockUpdate); +} + +bool QEventLoopEx::processEvents( ProcessEventsFlags flags ) +{ + if(!QEventLoop::processEvents(flags)) + return false; + + activateSocketNotifiers(); + return true; +} + +void QEventLoopEx::setSocketNotifierPending( QSocketNotifier *notifier ) +{ + int sockfd = notifier->socket(); + int type = notifier->type(); + if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) + { +#if defined(QT_CHECK_RANGE) + qWarning( "QSocketNotifier: Internal error" ); +#endif + return; + } +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::setSocketNotifierPending %p",notifier ); +#endif + EnterCriticalSection(&d->m_csVec); + + QPtrList *list = d->sn_vec[type].list; + QSockNotEx *sn; + if ( ! list ) + { +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::setSocketNotifierPending %p: no list",notifier ); +#endif + LeaveCriticalSection(&d->m_csVec); + return; + } + sn = list->first(); + while ( sn && !(sn->obj == notifier && sn->fd == sockfd) ) + sn = list->next(); + if ( ! sn ) { // not found +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::setSocketNotifierPending %p: not found",notifier ); +#endif + LeaveCriticalSection(&d->m_csVec); + return; + } + + // We choose a random activation order to be more fair under high load. + // If a constant order is used and a peer early in the list can + // saturate the IO, it might grab our attention completely. + // Also, if we're using a straight list, the callback routines may + // delete other entries from the list before those other entries are + // processed. + EnterCriticalSection(&d->m_csPendingList); + if ( ! FD_ISSET( sn->fd, sn->queue ) ) { + d->sn_pending_list.insert( (rand() & 0xff) % + (d->sn_pending_list.count()+1), sn ); + FD_SET( sn->fd, sn->queue ); + } + LeaveCriticalSection(&d->m_csPendingList); + LeaveCriticalSection(&d->m_csVec); +} + +int QEventLoopEx::activateSocketNotifiers() +{ + if ( d->sn_pending_list.isEmpty() ) + return 0; // nothing to do + + int n_act = 0; + QEvent event( QEvent::SockAct ); + + EnterCriticalSection(&d->m_csVec); // Avoid deaklock + EnterCriticalSection(&d->m_csPendingList); + QPtrListIterator it( d->sn_pending_list ); + QSockNotEx *sn; + while ( (sn=it.current()) ) { + ++it; + d->sn_pending_list.removeRef( sn ); + if ( FD_ISSET(sn->fd, sn->queue) ) { + FD_CLR( sn->fd, sn->queue ); +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx:activateSocketNotifiers %p to object %p",sn, sn->obj); +#endif + QApplication::sendEvent( sn->obj, &event ); + n_act++; + } + } + + LeaveCriticalSection(&d->m_csPendingList); + LeaveCriticalSection(&d->m_csVec); // Avoid deaklock + +#ifdef _DEBUG_EVENTLOOPEX + qDebug( "QSocketNotifier::activateSocketNotifiers set m_evPendingListEmpty"); +#endif + SetEvent(d->m_evPendingListEmpty); + + return n_act; +} + +DWORD QEventLoopEx::ThreadProc(void * p) +{ + QEventLoopEx * pEventLoopEx = static_cast(p); + pEventLoopEx->run(); + return 0; +} + +void QEventLoopEx::run() +{ + do + { + EnterCriticalSection(&d->m_csVec); + // return the highest fd we can wait for input on + if ( d->sn_highest >= 0 ) { // has socket notifier(s) + if ( d->sn_vec[0].list && ! d->sn_vec[0].list->isEmpty() ) + d->sn_vec[0].select_fds = d->sn_vec[0].enabled_fds; + else + FD_ZERO( &d->sn_vec[0].select_fds ); + + if ( d->sn_vec[1].list && ! d->sn_vec[1].list->isEmpty() ) + d->sn_vec[1].select_fds = d->sn_vec[1].enabled_fds; + else + FD_ZERO( &d->sn_vec[1].select_fds ); + + if ( d->sn_vec[2].list && ! d->sn_vec[2].list->isEmpty() ) + d->sn_vec[2].select_fds = d->sn_vec[2].enabled_fds; + else + FD_ZERO( &d->sn_vec[2].select_fds ); + } + else { + FD_ZERO( &d->sn_vec[0].select_fds ); + FD_ZERO( &d->sn_vec[1].select_fds ); + FD_ZERO( &d->sn_vec[2].select_fds ); + } + + FD_SET(d->m_sockUpdate,&d->sn_vec[0].select_fds); + d->sn_highest = QMAX(d->sn_highest,(int)d->m_sockUpdate); +// FD_SET(m_sockUpdate,&sn_vec[1].select_fds); +// FD_SET(m_sockUpdate,&sn_vec[2].select_fds); + + LeaveCriticalSection(&d->m_csVec); + +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx: select(%d,%d, %d, %d)",sn_highest,sn_vec[0].select_fds.fd_count,sn_vec[1].select_fds.fd_count,sn_vec[2].select_fds.fd_count); +#endif + int nsel = select( d->sn_highest, + &d->sn_vec[0].select_fds, + &d->sn_vec[1].select_fds, + &d->sn_vec[2].select_fds, + NULL ); +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx: select returned %d",nsel); +#endif + if (nsel == SOCKET_ERROR) { + if (WSAGetLastError() == WSAENOTSOCK) { + + + // it seems a socket notifier has a bad fd... find out + // which one it is and disable it + fd_set fdset; + struct timeval zerotm; + int ret; + zerotm.tv_sec = zerotm.tv_usec = 0l; + + FD_ZERO(&fdset); + FD_SET(d->m_sockUpdate, &fdset); + + ret = select(d->m_sockUpdate + 1, &fdset, 0, 0, &zerotm); + if(ret == SOCKET_ERROR && WSAGetLastError() == WSAENOTSOCK) + { + // Update the waiting sockets + d->m_sockUpdate = socket(AF_INET,SOCK_DGRAM,0); + } + else + { + EnterCriticalSection(&d->m_csVec); + + for (int type = 0; type < 3; ++type) + { + QPtrList *list = d->sn_vec[type].list; + if (!list) + continue; + + QSockNotEx *sn = list->first(); + while (sn) { + FD_ZERO(&fdset); + FD_SET(sn->fd, &fdset); + + + do { + switch (type) { + case 0: // read + ret = select(sn->fd + 1, &fdset, 0, 0, &zerotm); + break; + case 1: // write + ret = select(sn->fd + 1, 0, &fdset, 0, &zerotm); + break; + case 2: // except + ret = select(sn->fd + 1, 0, 0, &fdset, &zerotm); + break; + } + } while (ret == SOCKET_ERROR && WSAGetLastError() != WSAENOTSOCK); + + if (ret == SOCKET_ERROR && WSAGetLastError() == WSAENOTSOCK) + { + // disable the invalid socket notifier + static const char *t[] = { "Read", "Write", "Exception" }; + qWarning("QSocketNotifier: invalid socket %d and type '%s', disabling...", + sn->fd, t[type]); + sn->obj->setEnabled(FALSE); + } + + sn = list->next(); + } + } + LeaveCriticalSection(&d->m_csVec); + } + } else { + // EINVAL... shouldn't happen, so let's complain to stderr + // and hope someone sends us a bug report + DWORD dw = WSAGetLastError(); + qWarning("QEventLoopEx: select failed with error %i\n",dw); + } + } + else + { + EnterCriticalSection(&d->m_csVec); + + if(FD_ISSET( d->m_sockUpdate, &d->sn_vec[0].select_fds)) + { + d->m_sockUpdate = socket(AF_INET,SOCK_DGRAM,0); +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx: update socket signaled -> recreate it %i",d->m_sockUpdate); +#endif + } + + // if select says data is ready on any socket, then set the socket notifier + // to pending + int i; + for ( i=0; i<3; i++ ) + { + if ( ! d->sn_vec[i].list ) + continue; + + QPtrList *list = d->sn_vec[i].list; + QSockNotEx *sn = list->first(); + while ( sn ) { + if ( FD_ISSET( sn->fd, &d->sn_vec[i].select_fds ) ) + { + QEvent event( QEvent::SockAct ); + setSocketNotifierPending( sn->obj ); + } + sn = list->next(); + } + } + LeaveCriticalSection(&d->m_csVec); + } + if(!d->sn_pending_list.isEmpty() ) + { + QApplication::eventLoop()->wakeUp(); +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx: wake up main event loop and wait for pending list empty"); +#endif + WaitForSingleObject(d->m_evPendingListEmpty,INFINITE); +#ifdef _DEBUG_EVENTLOOPEX + qDebug("QEventLoopEx: pending list now empty again"); +#endif + ResetEvent(d->m_evPendingListEmpty); + } + } + while(!d->m_bStopped); +} + +#include "qeventloopex.moc" diff --git a/win/qeventloopex.h b/win/qeventloopex.h new file mode 100644 index 000000000..cf9838633 --- /dev/null +++ b/win/qeventloopex.h @@ -0,0 +1,58 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2005 Andreas Roth + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#if !defined(__QEVENTLOOPEX_H_) +#define __QEVENTLOOPEX_H_ + +#include +#include +#include + +#include + +class QEventLoopExPrivate; + +class QEventLoopEx : public QEventLoop +{ + Q_OBJECT + +public: + QEventLoopEx( QObject *parent = 0, const char *name = 0 ); + virtual ~QEventLoopEx(); + +public: + virtual void registerSocketNotifier( QSocketNotifier * ); + virtual void unregisterSocketNotifier( QSocketNotifier * ); + virtual bool processEvents( ProcessEventsFlags flags ); + + void setSocketNotifierPending( QSocketNotifier *notifier ); + int activateSocketNotifiers(); + +protected: + void run(); + +private: + static DWORD WINAPI ThreadProc(void * p); + + // data for the default implementation - other implementations should not + // use/need this data + QEventLoopExPrivate *d; +}; + +#endif // __QEVENTLOOPEX_H_ diff --git a/win/readdir.c b/win/readdir.c new file mode 100644 index 000000000..501e777b0 --- /dev/null +++ b/win/readdir.c @@ -0,0 +1,146 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * Portions of this software are based upon public domain software + * originally written at the National Center for Supercomputing Applications, + * University of Illinois, Urbana-Champaign. + */ + +#include +#include +#include + +#include "readdir.h" + +/********************************************************************** + * Implement dirent-style opendir/readdir/closedir on Window 95/NT + * + * Functions defined are opendir(), readdir() and closedir() with the + * same prototypes as the normal dirent.h implementation. + * + * Does not implement telldir(), seekdir(), rewinddir() or scandir(). + * The dirent struct is compatible with Unix, except that d_ino is + * always 1 and d_off is made up as we go along. + * + * The DIR typedef is not compatible with Unix. + **********************************************************************/ + +KDEWIN32_EXPORT DIR * opendir(const char *dir) +{ + DIR *dp; + char *filespec; + long handle; + int index; + + filespec = malloc(strlen(dir) + 2 + 1); + strcpy(filespec, dir); + index = strlen(filespec) - 1; + if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) + filespec[index] = '\0'; + strcat(filespec, "\\*"); + + dp = (DIR *)malloc(sizeof(DIR)); + dp->offset = 0; + dp->finished = 0; + dp->dir = strdup(dir); + + if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { + if (errno == ENOENT) + dp->finished = 1; + else + return NULL; + } + + dp->handle = handle; + free(filespec); + + return dp; +} + +KDEWIN32_EXPORT struct dirent * readdir(DIR *dp) +{ + if (!dp || dp->finished) return NULL; + + if (dp->offset != 0) { + if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { + dp->finished = 1; + return NULL; + } + } + dp->offset++; + + strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); + dp->dent.d_ino = 1; + dp->dent.d_reclen = strlen(dp->dent.d_name); + dp->dent.d_off = dp->offset; + + return &(dp->dent); +} + +KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +{ + //todo: remove this when readdir_r.c will be ported + result = 0; + return 0; +} + +KDEWIN32_EXPORT int closedir(DIR *dp) +{ + if (!dp) return 0; + _findclose(dp->handle); + if (dp->dir) free(dp->dir); + if (dp) free(dp); + + return 0; +} + diff --git a/win/readdir.h b/win/readdir.h new file mode 100644 index 000000000..d2330844c --- /dev/null +++ b/win/readdir.h @@ -0,0 +1,104 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * Portions of this software are based upon public domain software + * originally written at the National Center for Supercomputing Applications, + * University of Illinois, Urbana-Champaign. + */ + +/* + * Structures and types used to implement opendir/readdir/closedir + * on Windows 95/NT. + */ + +#ifndef APACHE_READDIR_H +#define APACHE_READDIR_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +//#ifndef API_EXPORT +//# define API_EXPORT(type) __declspec(dllexport) type __stdcall +//#endif + +/* struct dirent - same as Unix */ +struct dirent { + long d_ino; /* inode (always 1 in WIN32) */ + off_t d_off; /* offset to this dirent */ + unsigned short d_reclen; /* length of d_name */ + char d_name[_MAX_FNAME+1]; /* filename (null terminated) */ +}; + +/* typedef DIR - not the same as Unix */ +typedef struct { + long handle; /* _findfirst/_findnext handle */ + short offset; /* offset into directory */ + short finished; /* 1 if there are not more files */ + struct _finddata_t fileinfo; /* from _findfirst/_findnext */ + char *dir; /* the dir we are reading */ + struct dirent dent; /* the dirent to return */ +} DIR; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/win/realpath.c b/win/realpath.c new file mode 100644 index 000000000..a2a255369 --- /dev/null +++ b/win/realpath.c @@ -0,0 +1,114 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Werner Almesberger + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include + +#include "unistd.h" + +/** + * @internal Canonical name: never ends with a slash + */ +static int resolve_path(char *path,char *result,char *pos) +{ + if (*path == '/') { + *result = '/'; + pos = result+1; + path++; + } + *pos = 0; + if (!*path) + return 0; + while (1) { + char *slash; + struct stat st; + + slash = *path ? strchr(path,'/') : NULL; + if (slash) + *slash = 0; + if (!path[0] || (path[0] == '.' && + (!path[1] || (path[1] == '.' && !path[2])))) { + pos--; + if (pos != result && path[0] && path[1]) + while (*--pos != '/'); + } + else { + strcpy(pos,path); + if (lstat(result,&st) < 0) + return -1; + if (S_ISLNK(st.st_mode)) { + char buf[PATH_MAX]; + + if (readlink(result,buf,sizeof(buf)) < 0) + return -1; + *pos = 0; + if (slash) { + *slash = '/'; + strcat(buf,slash); + } + strcpy(path,buf); + if (*path == '/') + result[1] = 0; + pos = strchr(result,0); + continue; + } + pos = strchr(result,0); + } + if (slash) { + *pos++ = '/'; + path = slash+1; + } + *pos = 0; + if (!slash) + break; + } + return 0; +} + +/** @return the canonicalized absolute pathname */ +KDEWIN32_EXPORT char *realpath(const char *path,char *resolved_path) +{ + char cwd[PATH_MAX]; + char *path_copy; + int res; + + if (!*path) { + errno = ENOENT; + return NULL; + } + if (!getcwd(cwd,sizeof(cwd))) + return NULL; + strcpy(resolved_path,"/"); + if (resolve_path(cwd,resolved_path,resolved_path)) + return NULL; + strcat(resolved_path,"/"); + path_copy = strdup(path); + if (!path_copy) + return NULL; + res = resolve_path(path_copy,resolved_path,strchr(resolved_path,0)); + free(path_copy); + if (res) + return NULL; + return resolved_path; +} + diff --git a/win/resource.c b/win/resource.c new file mode 100644 index 000000000..f027e25b6 --- /dev/null +++ b/win/resource.c @@ -0,0 +1,37 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +/* these functions always fail. for win32 */ + +KDEWIN32_EXPORT int getrlimit (int __resource, struct rlimit *__rlp) +{ + return -1; +} + +KDEWIN32_EXPORT int setrlimit (int __resource, const struct rlimit *__rlp) +{ + return -1; +} + +KDEWIN32_EXPORT int getrusage (int __who, struct rusage *__rusage) +{ + return -1; +} diff --git a/win/resources/kbuildsycoca.res b/win/resources/kbuildsycoca.res new file mode 100644 index 000000000..b26e2349c Binary files /dev/null and b/win/resources/kbuildsycoca.res differ diff --git a/win/signal.c b/win/signal.c new file mode 100644 index 000000000..533372017 --- /dev/null +++ b/win/signal.c @@ -0,0 +1,53 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include + +KDEWIN32_EXPORT int kill(pid_t pid, int sig) +{ + int ret; + HANDLE h = OpenProcess(PROCESS_TERMINATE,FALSE,(DWORD)pid); + ret = (h != NULL)?0:ESRCH; + if(h) + { + TerminateProcess(h,sig); + CloseHandle(h); + } + return ret; +} + +KDEWIN32_EXPORT pid_t waitpid(pid_t p, int *a, int b) +{ + int ret; + HANDLE h = OpenProcess(PROCESS_TERMINATE,FALSE,(DWORD)p); + ret = (h != NULL)?p:-1; + if(h) + { + DWORD dw; + WaitForSingleObject(h,INFINITE); + GetExitCodeProcess(h,&dw); + CloseHandle(h); + } + else + errno = ECHILD; + return ret; +} + diff --git a/win/signal.h b/win/signal.h new file mode 100644 index 000000000..32ca1663b --- /dev/null +++ b/win/signal.h @@ -0,0 +1,77 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SIGNAL_H +#define SIGNAL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//additional defs (some are sommented out because winows defines these): +#define SIGHUP 1 /* hangup */ +/* #define SIGINT 2*/ /* interrupt */ +#define SIGQUIT 3 /* quit */ +/* #define SIGILL 4*/ /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +/* #define SIGABRT 6*/ /* used by abort */ +#define SIGEMT 7 /* EMT instruction */ +/* #define SIGFPE 8*/ /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +/* #define SIGTERM 15*/ /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + +KDEWIN32_EXPORT int kill(pid_t pid, int sig); + +#ifdef __cplusplus +} +#endif + +/* regular signal.h */ +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + +#endif SIGNAL_H diff --git a/win/socket.h b/win/socket.h new file mode 100644 index 000000000..4103b3190 --- /dev/null +++ b/win/socket.h @@ -0,0 +1,169 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SOCKET_H +#define _SOCKET_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct sockaddr { + unsigned short sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +struct linger { + unsigned short l_onoff; /* Linger active */ + unsigned short l_linger; /* How long to linger for */ +}; + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + int msg_iovlen; /* Number of blocks */ + void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ + int msg_accrightslen; /* Length of rights list */ +}; + +#ifndef socklen_t +#define socklen_t int +#endif + +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ + +/* Supported address families. */ +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_LOCAL 1 /* POSIX name for AF_UNIX */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO /* OSI is ISO */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* AppleTalk */ +#define AF_NETBIOS 17 /* NetBios-style addresses */ +#define AF_INET6 23 /* IP version 6 */ + +#define AF_MAX 32 +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_LOCAL AF_LOCAL +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_OSI +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_NETBIOS AF_NETBIOS +#define PF_INET6 AF_INET6 + +#define PF_MAX AF_MAX + +/* Maximum queue length specificable by listen. */ +#define SOMAXCONN 5 + +/* Flags we can use with send/ and recv. */ +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_IP 0 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_TCP 6 +#define SOL_UDP 17 + +/* IP options */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* IP options for use with WinSock */ + +#define IP_OPTIONS 1 +#define IP_MULTICAST_IF 2 +#define IP_MULTICAST_TTL 3 +#define IP_MULTICAST_LOOP 4 +#define IP_ADD_MEMBERSHIP 5 +#define IP_DROP_MEMBERSHIP 6 +#define IP_TTL 7 +#define IP_TOS 8 +#define IP_DONTFRAGMENT 9 + +/* IPX options */ +#define IPX_TYPE 1 + +/* TCP options - this way around because someone left a set in the c library includes */ +#define TCP_NODELAY 0x0001 +#define TCP_MAXSEG 2 + +/* The various priorities. */ +#define SOPRI_INTERACTIVE 0 +#define SOPRI_NORMAL 1 +#define SOPRI_BACKGROUND 2 + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/win/stdint.h b/win/stdint.h new file mode 100644 index 000000000..e671c17e0 --- /dev/null +++ b/win/stdint.h @@ -0,0 +1,191 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _STDINT_H +#define _STDINT_H + +/* Exact-width integer types */ + +#ifndef __int8_t_defined +#define __int8_t_defined +typedef signed char int8_t; +typedef short int16_t; +typedef long int32_t; +typedef long long int64_t; +#endif + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +#ifndef __uint32_t_defined +#define __uint32_t_defined +typedef unsigned long uint32_t; +#endif +typedef unsigned long long uint64_t; + +/* Minimum-width integer types */ + +typedef signed char int_least8_t; +typedef short int_least16_t; +typedef long int_least32_t; +typedef long long int_least64_t; + +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned long uint_least32_t; +typedef unsigned long long uint_least64_t; + +/* Fastest minimum-width integer types */ + +typedef signed char int_fast8_t; +typedef long int_fast16_t; +typedef long int_fast32_t; +typedef long long int_fast64_t; + +typedef unsigned char uint_fast8_t; +typedef unsigned long uint_fast16_t; +typedef unsigned long uint_fast32_t; +typedef unsigned long long uint_fast64_t; + +/* Integer types capable of holding object pointers */ + +//#ifndef __intptr_t_defined +//#define __intptr_t_defined +//typedef long intptr_t; +//#endif +//typedef unsigned long uintptr_t; + +/* Greatest-width integer types */ + +typedef long long intmax_t; +typedef unsigned long long uintmax_t; + +/* Limits of exact-width integer types */ + +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807LL - 1LL) + +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807LL) + +#define UINT8_MAX (255) +#define UINT16_MAX (65535) +#define UINT32_MAX (4294967295UL) +#define UINT64_MAX (18446744073709551615ULL) + +/* Limits of minimum-width integer types */ + +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32768) +#define INT_LEAST32_MIN (-2147483647 - 1) +#define INT_LEAST64_MIN (-9223372036854775807LL - 1LL) + +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +#define UINT_LEAST8_MAX (255) +#define UINT_LEAST16_MAX (65535) +#define UINT_LEAST32_MAX (4294967295UL) +#define UINT_LEAST64_MAX (18446744073709551615ULL) + +/* Limits of fastest minimum-width integer types */ + +#define INT_FAST8_MIN (-128) +#define INT_FAST16_MIN (-2147483647 - 1) +#define INT_FAST32_MIN (-2147483647 - 1) +#define INT_FAST64_MIN (-9223372036854775807LL - 1LL) + +#define INT_FAST8_MAX (127) +#define INT_FAST16_MAX (2147483647) +#define INT_FAST32_MAX (2147483647) +#define INT_FAST64_MAX (9223372036854775807LL) + +#define UINT_FAST8_MAX (255) +#define UINT_FAST16_MAX (4294967295UL) +#define UINT_FAST32_MAX (4294967295UL) +#define UINT_FAST64_MAX (18446744073709551615ULL) + +/* Limits of integer types capable of holding object pointers */ + +#define INTPTR_MIN (-2147483647 - 1) +#define INTPTR_MAX (2147483647) +#define UINTPTR_MAX (4294967295UL) + +/* Limits of greatest-width integer types */ + +#define INTMAX_MIN (-9223372036854775807LL - 1LL) +#define INTMAX_MAX (9223372036854775807LL) +#define UINTMAX_MAX (18446744073709551615ULL) + +/* Limits of other integer types */ + +#ifndef PTRDIFF_MIN +#define PTRDIFF_MIN (-2147483647 - 1) +#define PTRDIFF_MAX (2147483647) +#endif + +#ifndef SIG_ATOMIC_MIN +#define SIG_ATOMIC_MIN (-2147483647 - 1) +#endif +#ifndef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MAX (2147483647) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (4294967295UL) +#endif + +#ifndef WCHAR_MIN +#ifdef __WCHAR_MIN__ +#define WCHAR_MIN __WCHAR_MIN__ +#define WCHAR_MAX __WCHAR_MAX__ +#else +#define WCHAR_MIN (0) +#define WCHAR_MAX (65535) +#endif +#endif + +#ifndef WINT_MIN +#define WINT_MIN (-2147483647 - 1) +#define WINT_MAX (2147483647) +#endif + +/* Macros for minimum-width integer constant expressions */ + +#define INT8_C(x) x +#define INT16_C(x) x +#define INT32_C(x) x ## L +#define INT64_C(x) x ## LL + +#define UINT8_C(x) x ## U +#define UINT16_C(x) x ## U +#define UINT32_C(x) x ## UL +#define UINT64_C(x) x ## ULL + +/* Macros for greatest-width integer constant expressions */ + +#define INTMAX_C(x) x ## L +#define UINTMAX_C(x) x ## UL + +#endif /* _STDINT_H */ diff --git a/win/stdlib.h b/win/stdlib.h new file mode 100644 index 000000000..576f72ad4 --- /dev/null +++ b/win/stdlib.h @@ -0,0 +1,57 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* + * Definitions for common types, variables, and functions. + */ + +#include + +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + +#define __need_size_t +#define __need_wchar_t +#include + +#ifndef _STDLIB_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDLIB_H_ + +#ifndef NULL +#define NULL 0 +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +/* from fakes.c */ +KDECORE_EXPORT int setenv(const char *__string, const char *__value, int __overwrite); +KDECORE_EXPORT void unsetenv(const char *__string); + +#ifdef __cplusplus +} +#endif + +#endif /* _STDLIB_H_ */ diff --git a/win/string.h b/win/string.h new file mode 100644 index 000000000..47895aa12 --- /dev/null +++ b/win/string.h @@ -0,0 +1,53 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDEWIN_STRING_H +#define KDEWIN_STRING_H + +#include + +#define strncasecmp strnicmp +#define strcasecmp stricmp + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* implemented in fakes.c */ +KDECORE_EXPORT unsigned long strlcpy(char *dst, const char *src, unsigned long siz); + +/* implemented in fakes.c */ +KDECORE_EXPORT unsigned long strlcat(char *dst, const char *src, unsigned long siz); + +KDEWIN32_EXPORT char* strndup(const char *src, size_t n); + +#ifdef __cplusplus +} +#endif + +/* regular string.h */ +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + +#endif /* KDEWIN_STRING_H */ diff --git a/win/strings.h b/win/strings.h new file mode 100644 index 000000000..f9d2b71d9 --- /dev/null +++ b/win/strings.h @@ -0,0 +1,22 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +//empty for now, to avoid #ifdefs + + diff --git a/win/strndup.c b/win/strndup.c new file mode 100644 index 000000000..0f4d14120 --- /dev/null +++ b/win/strndup.c @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +KDEWIN32_EXPORT char* strndup(const char *src, size_t n) +{ + const size_t len = MIN(strlen(src), n); + char *copy = malloc(len + 1); + if (copy) { + memcpy (copy, src, len); + copy[len] = '\0'; + } + return copy; +} + diff --git a/win/sys/fcntl.h b/win/sys/fcntl.h new file mode 100644 index 000000000..6e5cacdbe --- /dev/null +++ b/win/sys/fcntl.h @@ -0,0 +1,26 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* regular sys/fcntl.h */ +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + diff --git a/win/sys/file.h b/win/sys/file.h new file mode 100644 index 000000000..883047a0f --- /dev/null +++ b/win/sys/file.h @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _FILE_H_ +#define _FILE_H_ + +#include + +#define L_SET 0 +#define L_CURR 1 +#define L_INCR 1 +#define L_XTND 2 + +#define F_OK 0 /* does file exist */ +#define X_OK 1 /* is it executable by caller */ +#define W_OK 2 /* is it writable by caller */ +#define R_OK 4 /* is it readable by caller */ + +#endif diff --git a/win/sys/lock.h b/win/sys/lock.h new file mode 100644 index 000000000..6735496c9 --- /dev/null +++ b/win/sys/lock.h @@ -0,0 +1,41 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __SYS_LOCK_H__ +#define __SYS_LOCK_H__ + +/* dummy lock routines for single-threaded aps */ + +typedef int _LOCK_T; +typedef int _LOCK_RECURSIVE_T; + +#define __LOCK_INIT(class,lock) static int lock = 0; +#define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0; +#define __lock_init(lock) {} +#define __lock_init_recursive(lock) {} +#define __lock_close(lock) {} +#define __lock_close_recursive(lock) {} +#define __lock_acquire(lock) {} +#define __lock_acquire_recursive(lock) {} +#define __lock_try_acquire(lock) {} +#define __lock_try_acquire_recursive(lock) {} +#define __lock_release(lock) {} +#define __lock_release_recursive(lock) {} + +#endif /* __SYS_LOCK_H__ */ diff --git a/win/sys/mman.h b/win/sys/mman.h new file mode 100644 index 000000000..d28bcba88 --- /dev/null +++ b/win/sys/mman.h @@ -0,0 +1,58 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + These sources are based on ftp://g.oswego.edu/pub/misc/malloc.c + file by Doug Lea, released to the public domain. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _MMAP_H +#define _MMAP_H + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These values don't really matter in windows mmap emulation */ +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xF +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +#define MAP_FAILED ((void *)-1) + +KDEWIN32_EXPORT void * mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset); + +KDEWIN32_EXPORT int munmap(void *start, size_t length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/win/sys/param.h b/win/sys/param.h new file mode 100644 index 000000000..d815a232b --- /dev/null +++ b/win/sys/param.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KDEWIN_SYS_PARAM_H +#define _KDEWIN_SYS_PARAM_H + +/* This is defined to be the same as MAX_PATH which is used internally. + The Posix version is PATH_MAX. */ +#define MAXPATHLEN (260 - 1 /*NUL*/) + +/* some programs use this: */ +#ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +#endif + +#define BYTE_ORDER LITTLE_ENDIAN + +#ifndef NULL +#define NULL 0L +#endif + +#endif diff --git a/win/sys/resource.h b/win/sys/resource.h new file mode 100644 index 000000000..a505f2838 --- /dev/null +++ b/win/sys/resource.h @@ -0,0 +1,91 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_RESOURCE_H_ +#define _SYS_RESOURCE_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define RLIMIT_CPU 0 /* CPU time in seconds */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ +#define RLIMIT_NOFILE 5 /* max number of open files */ +#define RLIMIT_OFILE RLIMIT_NOFILE /* BSD name */ +#define RLIMIT_AS 6 /* address space (virt. memory) limit */ + +#define RLIMIT_NLIMITS 7 /* upper bound of RLIMIT_* defines */ +#define RLIM_NLIMITS RLIMIT_NLIMITS + +#define RLIM_INFINITY (0xffffffffUL) +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + +typedef unsigned long rlim_t; + +struct rlimit { + rlim_t rlim_cur; + rlim_t rlim_max; +}; + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +/* +struct timeval { + long tv_sec; + long tv_usec; +}; +*/ +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; + long ru_ixrss; /* XXX: 0 */ + long ru_idrss; /* XXX: sum of rm_asrss */ + long ru_isrss; /* XXX: 0 */ + long ru_minflt; /* any page faults not requiring I/O */ + long ru_majflt; /* any page faults requiring I/O */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ +#define ru_last ru_nivcsw +}; + +KDEWIN32_EXPORT int getrlimit (int __resource, struct rlimit *__rlp); +KDEWIN32_EXPORT int setrlimit (int __resource, const struct rlimit *__rlp); +KDEWIN32_EXPORT int getrusage (int __who, struct rusage *__rusage); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/win/sys/signal.h b/win/sys/signal.h new file mode 100644 index 000000000..11a3b3677 --- /dev/null +++ b/win/sys/signal.h @@ -0,0 +1,20 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "../signal.h" diff --git a/win/sys/socket.h b/win/sys/socket.h new file mode 100644 index 000000000..e8a2f6496 --- /dev/null +++ b/win/sys/socket.h @@ -0,0 +1,71 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +#include + +//#define WIN32_LEAN_AND_MEAN +#include + +#if 0 +#ifdef __cplusplus +/*extern "C" {*/ +#endif + +/* SUS symbolic values for the second parm to shutdown(2) */ +#define SHUT_RD 0 /* == Win32 SD_RECEIVE */ +#define SHUT_WR 1 /* == Win32 SD_SEND */ +#define SHUT_RDWR 2 /* == Win32 SD_BOTH */ + + int accept (int, struct sockaddr *__peer, int *); + int bind (int, const struct sockaddr *__my_addr, int __addrlen); + int connect (int, const struct sockaddr *, int); + int getpeername (int, struct sockaddr *__peer, int *); + int getsockname (int, struct sockaddr *__addr, int *); + int listen (int, int __n); + int recv (int, void *__buff, int __len, unsigned int __flags); + int recvfrom (int, char *__buff, int __len, int __flags, + struct sockaddr *__from, int *__fromlen); + int recvmsg(int s, struct msghdr *msg, int flags); + int send (int, const void *__buff, int __len, unsigned int __flags); + int sendmsg(int s, const struct msghdr *msg, int flags); + int sendto (int, const void *, int, unsigned int, const struct sockaddr *, int); + int setsockopt (int __s, int __level, int __optname, const void *optval, int __optlen); + int getsockopt (int __s, int __level, int __optname, void *__optval, int *__optlen); + int shutdown (int, int); +/* defined in winsock: int socket (int __family, int __type, int __protocol);*/ + int socketpair (int __domain, int __type, int __protocol, int *__socket_vec); + +/*defined in winsock: struct servent *getservbyname (const char *__name, const char *__proto); */ + +//#define WIN32_LEAN_AND_MEAN +#include + +#if 0 +#ifdef __cplusplus +/*};*/ +#endif + +#endif + +#endif + +#endif /* _SYS_SOCKET_H */ diff --git a/win/sys/stat.h b/win/sys/stat.h new file mode 100644 index 000000000..2b22558bc --- /dev/null +++ b/win/sys/stat.h @@ -0,0 +1,108 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#include + +/* regular sys/stat.h */ +#ifdef _MSC_VER +# include +/*# ifdef _INC_STAT +# define _STAT_H_ +# endif*/ +#elif defined(__BORLANDC__) +# include +#endif + +typedef short nlink_t; + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined _STAT_H_ && !defined _INC_DIRECT + +#define _IFMT 0170000 // type of file +#define _IFDIR 0040000 // directory +#define _IFCHR 0020000 // character special +#define _IFBLK 0060000 // block special +#define _IFREG 0100000 // regular +#define _IFLNK 0120000 // symbolic link +#define _IFSOCK 0140000 // socket +#define _IFIFO 0010000 // fifo + +#define S_BLKSIZE 1024 // size of a block + +#define S_ISUID 0004000 // set user id on execution +#define S_ISGID 0002000 // set group id on execution +#define S_ISVTX 0001000 // save swapped text even after use + +#define S_IFBLK _IFBLK +#define S_IFLNK _IFLNK +#define S_IFSOCK _IFSOCK +#define S_IFIFO _IFIFO + +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#define S_IRUSR 0000400 /* read permission, owner */ +#define S_IWUSR 0000200 /* write permission, owner */ +#define S_IXUSR 0000100/* execute/search permission, owner */ +#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#define S_IRGRP 0000040 /* read permission, group */ +#define S_IWGRP 0000020 /* write permission, grougroup */ +#define S_IXGRP 0000010/* execute/search permission, group */ +#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#define S_IROTH 0000004 /* read permission, other */ +#define S_IWOTH 0000002 /* write permission, other */ +#define S_IXOTH 0000001/* execute/search permission, other */ + +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) +#define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) + +KDEWIN32_EXPORT int lstat( const char *__path, struct stat *__buf); + +// KDEWIN32_EXPORT int mkdir( const char *_path, mode_t __mode ); + extern int mkdir( const char *_path ); + extern int chdir( const char *dirname ); + extern char *getcwd( char *buffer, int maxlen ); + extern int rmdir( const char *dirname ); + +#endif + +#ifdef __cplusplus +} +#endif + +/* +#ifdef __cplusplus +//this is a C++ function!!! +//TODO: make available C function too... +KDEWIN32_EXPORT int mkdir( const char *_path, mode_t __mode ); +#endif +*/ +#endif /* _SYS_STAT_H */ diff --git a/win/sys/time.h b/win/sys/time.h new file mode 100644 index 000000000..0f0ca08a6 --- /dev/null +++ b/win/sys/time.h @@ -0,0 +1,51 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include + +//??#if !defined(_INC_TIME) + +#undef INCL_WINSOCK_API_PROTOTYPES +#define INCL_WINSOCK_API_PROTOTYPES 1 //for ntohl(), etc. +#include //timeval + +/*#ifndef _WINSOCK2API_ +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif*/ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +KDEWIN32_EXPORT int gettimeofday(struct timeval *__p, struct timezone *__z); +KDEWIN32_EXPORT int settimeofday(const struct timeval *, const struct timezone *); + +#ifdef __cplusplus +} +#endif + +#endif //_SYS_TIME_H_ diff --git a/win/sys/times.h b/win/sys/times.h new file mode 100644 index 000000000..e555e4888 --- /dev/null +++ b/win/sys/times.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H + +#include +//#include <_ansi.h> +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !defined(__clock_t_defined) && !defined(_CLOCK_T_DEFINED) +typedef _CLOCK_T_ clock_t; +#define __clock_t_defined +#endif + +struct tms { + clock_t tms_utime; /* user time */ + clock_t tms_stime; /* system time */ + clock_t tms_cutime; /* user time, children */ + clock_t tms_cstime; /* system time, children */ +}; + +KDEWIN32_EXPORT clock_t times(struct tms *); + +#ifdef __cplusplus +} +#endif +#endif /* !_SYS_TIMES_H */ diff --git a/win/sys/types.h b/win/sys/types.h new file mode 100644 index 000000000..9a01fa61d --- /dev/null +++ b/win/sys/types.h @@ -0,0 +1,61 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ + +/* regular types.h */ +#ifdef _MSC_VER +# include +#elif defined(__BORLANDC__) +# include +#endif + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +typedef unsigned int size_t; +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +typedef size_t ssize_t; +#endif + + +#ifndef socklen_t +#define socklen_t int +#endif + +//additional: +#ifndef _ASM_TYPES_H +#define _ASM_TYPES_H + +//typedef __signed__ char __s8; +typedef unsigned char __u8; + +//typedef __signed__ short __s16; +typedef unsigned short __u16; + +//typedef __signed__ int __s32; +typedef unsigned int __u32; + +#endif /* _ASM_TYPES_H */ + + +#endif diff --git a/win/sys/uio.h b/win/sys/uio.h new file mode 100644 index 000000000..a78e29e13 --- /dev/null +++ b/win/sys/uio.h @@ -0,0 +1,20 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* dummy */ diff --git a/win/sys/un.h b/win/sys/un.h new file mode 100644 index 000000000..1763308b3 --- /dev/null +++ b/win/sys/un.h @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_UN_H +#define _SYS_UN_H + +/* POSIX requires only at least 100 bytes */ +#define UNIX_PATH_LEN 108 + +struct sockaddr_un { + unsigned short sun_family; /* address family AF_LOCAL/AF_UNIX */ + char sun_path[UNIX_PATH_LEN]; /* 108 bytes of socket address */ +}; + +/* Evaluates the actual length of `sockaddr_un' structure. */ +#define SUN_LEN(p) ((size_t)(((struct sockaddr_un *) NULL)->sun_path) \ + + strlen ((p)->sun_path)) + +#endif diff --git a/win/sys/utsname.h b/win/sys/utsname.h new file mode 100644 index 000000000..1560e0e6b --- /dev/null +++ b/win/sys/utsname.h @@ -0,0 +1,44 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct utsname +{ + char sysname[20]; + char nodename[20]; + char release[20]; + char version[20]; + char machine[20]; +}; + +KDEWIN32_EXPORT int uname (struct utsname *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/win/sys/wait.h b/win/sys/wait.h new file mode 100644 index 000000000..077f46618 --- /dev/null +++ b/win/sys/wait.h @@ -0,0 +1,82 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +/* A status looks like: + <2 bytes info> <2 bytes code> + + == 0, child has exited, info is the exit value + == 1..7e, child has exited, info is the signal number. + == 7f, child has stopped, info was the signal number. + == 80, there was a core dump. +*/ + +#define WIFEXITED(w) (((w) & 0xff) == 0) +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WEXITSTATUS(w) (((w) >> 8) & 0xff) +#define WTERMSIG(w) ((w) & 0x7f) +#define WSTOPSIG WEXITSTATUS + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int); +pid_t wait3 (int *__status, int __options, struct rusage *__rusage); +pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage); + +union wait + { + int w_status; + struct + { + unsigned int __w_termsig:7; /* Terminating signal. */ + unsigned int __w_coredump:1; /* Set if dumped core. */ + unsigned int __w_retcode:8; /* Return code if exited normally. */ + unsigned int:16; + } __wait_terminated; + struct + { + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int:16; + } __wait_stopped; + }; + +#define w_termsig __wait_terminated.__w_termsig +#define w_coredump __wait_terminated.__w_coredump +#define w_retcode __wait_terminated.__w_retcode +#define w_stopsig __wait_stopped.__w_stopsig +#define w_stopval __wait_stopped.__w_stopval + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/win/syslog.c b/win/syslog.c new file mode 100644 index 000000000..f2a754298 --- /dev/null +++ b/win/syslog.c @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "syslog.h" + +KDEWIN32_EXPORT void closelog (void) +{ + /*! @todo */ +} + +KDEWIN32_EXPORT void openlog (const char *ident , int option , int facility) +{ + /*! @todo */ +} + +KDEWIN32_EXPORT int setlogmask (int priority) +{ + /*! @todo */ + return 0; +} + +KDEWIN32_EXPORT void syslog (int priority, const char * format, ...) +{ + /*! @todo */ +} + diff --git a/win/syslog.h b/win/syslog.h new file mode 100644 index 000000000..d5d7ea27a --- /dev/null +++ b/win/syslog.h @@ -0,0 +1,99 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Jaroslaw Staniek + + Declarations based on original syslog.h, + Copyright (c) 1982, 1986, 1988, 1993 + The Regents of the University of California. All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _SYS_LOG_H +#define _SYS_LOG_H + +#include + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 0x07 + +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#define LOG_KERN (0<<3) +#define LOG_USER (1<<3) +#define LOG_MAIL (2<<3) +#define LOG_DAEMON (3<<3) +#define LOG_AUTH (4<<3) +#define LOG_SYSLOG (5<<3) +#define LOG_LPR (6<<3) +#define LOG_NEWS (7<<3) +#define LOG_UUCP (8<<3) +#define LOG_CRON (9<<3) +#define LOG_AUTHPRIV (10<<3) +#define LOG_FTP (11<<3) + +/* Codes through 15 are reserved for system use */ +#define LOG_LOCAL0 (16<<3) +#define LOG_LOCAL1 (17<<3) +#define LOG_LOCAL2 (18<<3) +#define LOG_LOCAL3 (19<<3) +#define LOG_LOCAL4 (20<<3) +#define LOG_LOCAL5 (21<<3) +#define LOG_LOCAL6 (22<<3) +#define LOG_LOCAL7 (23<<3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x03f8 +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#define LOG_MASK(pri) (1 << (pri)) +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#ifdef __cplusplus +extern "C" { +#endif + +KDEWIN32_EXPORT void closelog (void); +KDEWIN32_EXPORT void openlog (const char *ident , int option , int facility); +KDEWIN32_EXPORT int setlogmask (int priority); +KDEWIN32_EXPORT void syslog (int priority, const char * format, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_LOG_H */ diff --git a/win/time.c b/win/time.c new file mode 100644 index 000000000..e5a922e9b --- /dev/null +++ b/win/time.c @@ -0,0 +1,33 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "time.h" + +KDEWIN32_EXPORT int gettimeofday(struct timeval *__p, struct timezone *__z) +{ + /*! @todo */ + return 1; +} + +KDEWIN32_EXPORT int settimeofday(const struct timeval *__p, const struct timezone *__z) +{ + /*! @todo */ + return 1; +} + diff --git a/win/tools/.build_kdelibs_comon b/win/tools/.build_kdelibs_comon new file mode 100755 index 000000000..5ed09f724 --- /dev/null +++ b/win/tools/.build_kdelibs_comon @@ -0,0 +1,14 @@ +#!/bin/bash +# compile entire kdelibs/win32 : common part for dbg and release target +# (c) 2005, Jaroslaw Staniek, js@iidea.pl + +pwd=`pwd` +if [ -n "$MSVC" ] ; then + make='nmake -nologo' +elif [ -n "$BCB" ] ; then + #sometimes this could bmake (see qt3/free bootstrap) + make='make' +else + echo "No compiler detected (MSVC or other)" + exit 1 +fi diff --git a/win/tools/.check_kde_env b/win/tools/.check_kde_env new file mode 100755 index 000000000..d22cf13e6 --- /dev/null +++ b/win/tools/.check_kde_env @@ -0,0 +1,22 @@ +#!/bin/bash + +# checks current environment + +if [ -z "$KDEWIN" ] ; then + echo `basename $0`": \$KDEWIN environment variable is not set. Set it to absolute path of kdelibs/win32 source code, e.g. C:\\kdelibs" + exit 1 +fi + +if [ -z "$KDEDIR" ] ; then + echo `basename $0`": \$KDEDIR environment variable is not set. Set it to absolute path of kdelibs/win32 binaries, e.g. C:\\kde" + exit 1 +fi + +if [ -z "$KDELIBS" -o "$KDEWIN\\kdelibs" != "$KDELIBS" ] ; then + echo `basename $0`": \$KDELIBS = \"$KDELIBS\" but \$KDEWIN = \"$KDEWIN\"" + echo "\$KDELIBS environment variable is not properly set. Set it to absolute path of kdelibs/win32 source code. It needs to be equal to \"\$KDEWIN\\kdelibs\", e.g. C:\\kdewin32\\kdelibs". + echo "You may need to run:" + echo " source kde_env" + exit 1 +fi + diff --git a/win/tools/.copy_missing_headers b/win/tools/.copy_missing_headers new file mode 100755 index 000000000..9ac1e3906 --- /dev/null +++ b/win/tools/.copy_missing_headers @@ -0,0 +1,25 @@ +#!/bin/bash + +# copies missing compiler headers + +.check_kde_env || exit 1 + +if [ -n "$MSVC" ] ; then + dir="$MSVC/vc7/include" + mkdir -p "$KDELIBS/win/msvc/" || exit 1 + mkdir -p "$KDELIBS/win/sys/msvc/" || exit 1 + cp "$dir/ctype.h" "$dir/signal.h" "$dir/stdlib.h" "$dir/string.h" "$KDELIBS/win/msvc/" || exit 1 + cp "$dir/fcntl.h" "$dir/sys/stat.h" "$dir/sys/types.h" "$KDELIBS/win/sys/msvc/" || exit 1 + +elif [ -n "$BCB" ] ; then + dir="$BCB/include" + mkdir -p "$KDELIBS/win/bcc/" || exit 1 + mkdir -p "$KDELIBS/win/sys/bcc/" || exit 1 + cp "$dir/ctype.h" "$dir/signal.h" "$dir/stdlib.h" "$dir/string.h" "$KDELIBS/win/bcc/" || exit 1 + cp "$dir/fcntl.h" "$dir/sys/stat.h" "$dir/sys/types.h" "$KDELIBS/win/sys/bcc/" || exit 1 + +else + echo "No compiler detected (MSVC or other)" + exit 1 +fi + diff --git a/win/tools/README.tools b/win/tools/README.tools new file mode 100644 index 000000000..35b3a5264 --- /dev/null +++ b/win/tools/README.tools @@ -0,0 +1,6 @@ +kdelibs/win32 build tools + +(c) 2003-2005, Jaroslaw Staniek + +Add this directory to your PATH. +Cygwin (or other bash replacement) required. diff --git a/win/tools/build_kdelibs_dbg b/win/tools/build_kdelibs_dbg new file mode 100644 index 000000000..6b9aaed38 --- /dev/null +++ b/win/tools/build_kdelibs_dbg @@ -0,0 +1,82 @@ +#!/bin/bash +# compile entire kdelibs/win32 in debug mode +# (c) 2003-2005, Jaroslaw Staniek, js@iidea.pl + +if [ "$1" == "noclean" ] ; then + noclean=1 +fi + +update_kdelibs_pro_files || exit 1 +.copy_missing_headers || exit 1 +source .build_kdelibs_comon || exit 1 + +cd "$KDELIBS" + +echo "-------------------------------------------------" +echo "Building Debug Version of KDElibs/win32" +echo "Source directory: \$KDELIBS = $KDELIBS" +echo "Version: $KDE_VER_MAJ.$KDE_VER_MIN.$KDE_VER_PAT" +echo "Destination directory: \$KDEDIR = $KDEDIR" +if [ -n $noclean ] ; then + echo "Options: noclean" +fi +echo "-------------------------------------------------" +echo + +# special +cd win/9x && $make || exit 1 +cd "$pwd" + +if [ -d "kstyles/thinkeramik/widget-engine" ] ; then + additional="kstyles/thinkeramik/widget-engine/genembed kstyles/thinkeramik/widget-engine " +fi + +# all +for d in \ +win \ +libltdl \ +dcop/KDE-ICE \ +dcop \ +dcop/dcopidl \ +dcop/dcopidl2cpp \ +dcop/dcopserver \ +dcop/dcopserver_shutdown \ +dcop/iceauth \ +kdefx \ +$additional \ +kdecore \ +kdeui \ +kio \ +kresources \ +kabc/vcard \ +kabc \ +kutils \ +kparts \ +kmdi \ +kioslave/gzip \ +kioslave/bzip2 \ +interfaces/ktexteditor \ +kate/interfaces \ +kate/part \ + ; do + echo ================== $d ================= + cd $d || exit 1 + if [ -z $noclean ] ; then + $make clean + fi + qmake && $make || exit 1 + cd $pwd +done + +cd kdewidgets +qmake makekdewidgets.pro && $make clean && $make || exit 1 +qmake && $make clean && $make || exit 1 + +# copy kdewidgets plugin for Qt Designer +cp $KDEDIR/lib/kde3/plugins/designer/kdewidgets.dll $QTDIR/plugins/designer/ + +cd $pwd + +cd kded +./makeall.sh || exit 1 +cd $pwd diff --git a/win/tools/build_kdelibs_rel b/win/tools/build_kdelibs_rel new file mode 100644 index 000000000..54221f333 --- /dev/null +++ b/win/tools/build_kdelibs_rel @@ -0,0 +1,73 @@ +#!/bin/bash +# compile entire kdelibs/win32 in release mode +# (c) 2003-2005, Jaroslaw Staniek, js@iidea.pl + +if [ "$1" == "noclean" ] ; then + noclean=1 +fi + +update_kdelibs_pro_files || exit 1 +.copy_missing_headers || exit 1 +source .build_kdelibs_comon || exit 1 + +cd "$KDELIBS" + +echo "-------------------------------------------------" +echo "Building Release Version of KDElibs/win32" +echo "Source directory: \$KDELIBS = $KDELIBS" +echo "Version: $KDE_VER_MAJ.$KDE_VER_MIN.$KDE_VER_PAT" +echo "Destination directory: \$KDEDIR = $KDEDIR" +if [ -n $noclean ] ; then + echo "Options: noclean" +fi +echo "-------------------------------------------------" +echo + +# special +cd win/9x || exit 1 +if [ "$1" != "noclean" ] ; then + $make -f Makefile.rel clean +fi +$make -f Makefile.rel || exit 1 +cd $pwd + +# all +for d in \ +win \ +libltdl \ +dcop/KDE-ICE \ +dcop \ +dcop/dcopidl \ +dcop/dcopidl2cpp \ +dcop/dcopserver \ +dcop/dcopserver_shutdown \ +dcop/iceauth \ +kdefx \ +kdecore \ +kdeui \ +kstyles/thinkeramik/widget-engine \ +kio \ +kresources \ +kabc/vcard \ +kabc \ +kutils \ +kparts \ +kmdi \ +kioslave/gzip \ +kioslave/bzip2 \ +interfaces/ktexteditor \ +kate/interfaces \ +kate/part \ + ; do + echo ================== $d ================= + cd $d || exit 1 + if [ -z $noclean ] ; then + $make -f Makefile.release clean + fi + mkrel || exit 1 + cd $pwd +done + +cd kded +./makeall_rel.sh || exit 1 +cd $pwd diff --git a/win/tools/collect_kdelibs_pro_files b/win/tools/collect_kdelibs_pro_files new file mode 100755 index 000000000..ea2466ef2 --- /dev/null +++ b/win/tools/collect_kdelibs_pro_files @@ -0,0 +1,22 @@ +#!/bin/bash + +# Copies all used .pro (and a few shell) files kdelibs/ to kdelibs/win/pro_files/ +# what makes it easier to commit that to KDE CVS +# (c) 2005, Jaroslaw Staniek + +dest=win/pro_files +mkdir -p $dest + +.check_kde_env || exit 1 + +cd "$KDELIBS" + +for pro in `find . -name \*.pro | grep -v "\/\.\|^\.\/win/"` kded/makeall.sh kded/makeall_rel.sh ; do + dir=`dirname "$pro"` + mkdir -p "$dest/$dir" + if [ "$pro" -nt "$dest/$pro" ] ; then + cp -p "$pro" "$dest/$pro" + echo "$pro" + fi +done + diff --git a/win/tools/kdcopidl b/win/tools/kdcopidl new file mode 100755 index 000000000..f695659d7 --- /dev/null +++ b/win/tools/kdcopidl @@ -0,0 +1,25 @@ +#!/bin/sh + +# runs kdcopidl for current dir +# or for $1 dir, (and $2, $3, $4, $5), whatever is provided + +if [ -n "$1" ] ; then + dir="$1" +else + dir="." +fi + +find $dir -maxdepth 1 -name \*.h | while read ; do + grep K_DCOP $REPLY > /dev/null || continue + name=`echo $REPLY | sed -e "s/\\.h//"` + if [ $name".kidl" -ot $REPLY -o ! -f $name".kidl" -o ! -f $name"_skel.cpp" -o ! -f $name"_stub.cpp" ] ; then + echo DCOPIDL for $REPLY... + dcopidl $REPLY > $name".kidl" + dcopidl2cpp $name".kidl" + fi +done + +[ -n "$2" ] && kdcopidl $2 +[ -n "$3" ] && kdcopidl $3 +[ -n "$4" ] && kdcopidl $4 +[ -n "$5" ] && kdcopidl $5 diff --git a/win/tools/kde_env b/win/tools/kde_env new file mode 100755 index 000000000..5920eae99 --- /dev/null +++ b/win/tools/kde_env @@ -0,0 +1,29 @@ +#!/bin/bash +# +# KDElibs/win32 Build Environment +# + +# Copy kde_env_custom.template to kde_env_custom and this it's paths if needed: + +source "kde_env_custom" || exit 1 + +if [ -n "$MSVC" ] ; then + export PATH="$MSVC\\bin;$PATH" #to avoid conflict with, say, GNU link + export INCLUDE="$MSVC\\include;$INCLUDE" +fi + +# Generic settings +export KDELIBS=$KDEWIN\\kdelibs # KDElibs/win32 source directory +export INCLUDE="$KDELIBS\\win;$KDELIBS;$KDELIBS\\kdecore;$KDELIBS\\kdefx;$KDELIBS\\kdeprint;$KDELIBS\\kdeui;$KDELIBS\\kmdi;$KDELIBS\\dcop;$KDELIBS\\kio;$KDELIBS\\kio\\kio;$KDELIBS\\kio\\kfile;$INCLUDE" + +# Version information for binaries +# We're changing this from time to time + +export KDE_VER_MAJ=3 +export KDE_VER_MIN=5 +export KDE_VER_PAT=0 +export KDE_VER=$KDE_VER_MAJ$KDE_VER_MIN$KDE_VER_PAT + +# Utils + +export MAKE="nmake /NOLOGO" diff --git a/win/tools/kde_env_custom.template b/win/tools/kde_env_custom.template new file mode 100755 index 000000000..a498805e9 --- /dev/null +++ b/win/tools/kde_env_custom.template @@ -0,0 +1,15 @@ +#!/bin/bash + +# Copy this file as kde_env_custom and alter it + + + # MSVC instalation directory, please change, or comment it out if not using msvc compiler + MSVC="c:\\vs7" + +# Top KDE Directory - target of your compilation, please change +export KDEDIR="c:\\kde" + +# KDElibs/win32 top source directory, please change +KDEWIN="c:\\kdewin32" + +export MSVC KDEWIN INCLUDE diff --git a/win/tools/kmoc b/win/tools/kmoc new file mode 100755 index 000000000..2fef8ea60 --- /dev/null +++ b/win/tools/kmoc @@ -0,0 +1,19 @@ +#!/bin/bash + +# Creates KDE-compatible .moc files out of .h files in current directory +# .moc files are saved to moc/ subdirectory. +# Any additional arguments are directories - kmoc will be called for each of them. + +mkdir -p moc +find . -maxdepth 1 -name \*.h | while read ; do + grep Q_OBJECT $REPLY > /dev/null || continue + moc=moc/`echo $REPLY | sed -e "s/\\.h/\\.moc/;s/\\.\\///"` + if [ $moc -ot $REPLY ] ; then echo mocing $REPLY... ; moc $REPLY -o $moc ; fi +done + +pwd=`pwd` +while [ $# -gt 0 ] ; do + cd $pwd/$1 && kmoc + cd $pwd + shift +done diff --git a/win/tools/mkrel b/win/tools/mkrel new file mode 100755 index 000000000..34b9644ea --- /dev/null +++ b/win/tools/mkrel @@ -0,0 +1,11 @@ +#!/bin/bash + +# make relese version of lib/app in the cwd + +mkdir -p obj_rel + +if [ $# -eq 0 ] ; then + qmake KW_CONFIG=release -o Makefile.release || exit 1 +fi + +nmake -nologo -f Makefile.release $* diff --git a/win/tools/update_kdelibs_pro_files b/win/tools/update_kdelibs_pro_files new file mode 100755 index 000000000..15f745cf8 --- /dev/null +++ b/win/tools/update_kdelibs_pro_files @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copies all used .pro (and a few shell) files from kdelibs/win/pro_files/ to kdelibs/ +# so they can be used to build kdelibs. +# Note: only newer files are copied over older. +# (c) 2005, Jaroslaw Staniek, js@iidea.pl + +.check_kde_env || exit 1 + +src=win/pro_files +dest=../.. + +cd "$KDELIBS/$src" + +for pro in `find . -name \*.pro -o -name \*.sh` ; do + dir=`dirname "$pro"` + if [ ! -d "$KDELIBS/$dir" ] ; then + echo "no \$KDELIBS/$dir directory: creating it" + mkdir -p "$KDELIBS/$dir" + fi + + if [ ! "$pro" -nt "$dest/$pro" ] ; then + true +# echo "*SKIPPED* $pro is not newer than destination in $KDELIBS" + else + echo "UPDATING \$KDELIBS/$pro" + cp $pro $dest/$pro + fi +done + diff --git a/win/uname.c b/win/uname.c new file mode 100644 index 000000000..a6b8d7fd5 --- /dev/null +++ b/win/uname.c @@ -0,0 +1,263 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2007 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include + +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); + +#ifndef SM_SERVERR2 +# define SM_SERVERR2 89 +#endif + +int kde_gethostname(char *__name, size_t __len); + +/** + MS Windows implementation of uname(). + + E.g. on Windows 2000 + + utsname n; + printf("%s, %s, %s, %s, %s\n", n.sysname, n.release, n.version, n.machine, n.nodename); + + it will print something like: + + Microsoft Windows, 5.0 (2000 Professional), Dec 16 2004, i686, MYHOSTNAME + + + Note that utsname.version is just a compile time of kdewin32 library (__DATE__). +*/ +KDEWIN32_EXPORT int uname(struct utsname *name) +{ + OSVERSIONINFOEX versioninfo; + SYSTEM_INFO sysinfo; + PGNSI pGNSI; + unsigned int proctype; + char valid_processor_level; + char *ostype = 0; + char *osproduct = 0; + char tmpnodename[MAX_COMPUTERNAME_LENGTH+2]; + size_t tmpnodenamelen = MAX_COMPUTERNAME_LENGTH+1; + BOOL osVersionInfoEx; + + if (!name) + return -1; + + ZeroMemory(&sysinfo, sizeof(SYSTEM_INFO)); + ZeroMemory(&versioninfo, sizeof(OSVERSIONINFOEX)); + + /* Try calling GetVersionEx using the OSVERSIONINFOEX, + if that fails, try using the OSVERSIONINFO. */ + versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if ( !(osVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &versioninfo)) ) { + versioninfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (! GetVersionEx ( (OSVERSIONINFO *) &versioninfo) ) + return -1; + } + + valid_processor_level = versioninfo.dwPlatformId == VER_PLATFORM_WIN32_NT + || (versioninfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && versioninfo.dwMinorVersion >= 10 /*>= win98*/); + + /* Use GetNativeSystemInfo if supported or GetSystemInfo otherwise */ + pGNSI = (PGNSI) GetProcAddress( + GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); + if (NULL != pGNSI) + pGNSI(&sysinfo); + else + GetSystemInfo(&sysinfo); + + /* CPU type */ + switch (sysinfo.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_INTEL: + if (valid_processor_level) { + if (sysinfo.wProcessorLevel<3) + proctype = 3; + else if (sysinfo.wProcessorLevel > 9) /*Pentium 4?*/ + proctype = 6; + else /*typical*/ + proctype = sysinfo.wProcessorLevel; + } + else { + if (sysinfo.dwProcessorType == PROCESSOR_INTEL_386 + || sysinfo.dwProcessorType == PROCESSOR_INTEL_486) + proctype = sysinfo.dwProcessorType / 100; + else + proctype = PROCESSOR_INTEL_PENTIUM / 100; + } + sprintf (name->machine, "i%d86", proctype); + break; + case PROCESSOR_ARCHITECTURE_ALPHA: + strcpy (name->machine, "alpha"); + break; + case PROCESSOR_ARCHITECTURE_MIPS: + strcpy (name->machine, "mips"); + break; + default: + strcpy (name->machine, "unknown"); + break; + } + + strncpy(name->sysname, "Microsoft Windows", 19); + + /* OS Type */ + switch (versioninfo.dwPlatformId) { + case VER_PLATFORM_WIN32_NT: + switch (versioninfo.dwMajorVersion) { + case 3: + case 4: + ostype = "NT"; + break; + case 5: + switch (versioninfo.dwMinorVersion) { + case 0: + ostype = "2000"; + break; + case 1: + ostype = "XP"; + break; + case 2: + if( GetSystemMetrics(SM_SERVERR2) ) + ostype = "Server 2003 \"R2\""; + else if( versioninfo.wProductType == VER_NT_WORKSTATION + && sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + ostype = "XP Professional x64 Edition"; + else + ostype = "Server 2003"; + break; + } + break; + case 6: + switch (versioninfo.dwMinorVersion) { + case 0: + switch (versioninfo.wProductType) { + case VER_NT_WORKSTATION: + ostype = "Vista"; + break; + default: + ostype = "Server \"Longhorn\""; + break; + } + default: + break; + } + break; + default: + break; + } + break; + case VER_PLATFORM_WIN32_WINDOWS: + switch (versioninfo.dwMinorVersion) { + case 0: + ostype = "95"; + break; + case 10: + ostype = "98"; + break; + case 90: + ostype = "Me"; + break; + default: + break; + } + break; + default: + break; + } + + /* Test for specific product on Windows NT 4.0 SP6 and later */ + if (osVersionInfoEx) { + /* Workstation type */ + if ( versioninfo.wProductType == VER_NT_WORKSTATION + && sysinfo.wProcessorArchitecture!=PROCESSOR_ARCHITECTURE_AMD64) + { + if( versioninfo.dwMajorVersion == 4 ) + osproduct = "Workstation 4.0"; + else if( versioninfo.wSuiteMask & VER_SUITE_PERSONAL ) + osproduct = "Home Edition"; + else + osproduct = "Professional"; + } + /* Server type */ + else if ( versioninfo.wProductType == VER_NT_SERVER + || versioninfo.wProductType == VER_NT_DOMAIN_CONTROLLER ) + { + if (versioninfo.dwMajorVersion == 5 && versioninfo.dwMinorVersion == 2) { + if ( sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 ) { + if( versioninfo.wSuiteMask & VER_SUITE_DATACENTER ) + osproduct = "Datacenter Edition for Itanium-based Systems"; + else if( versioninfo.wSuiteMask & VER_SUITE_ENTERPRISE ) + osproduct = "Enterprise Edition for Itanium-based Systems"; + } + else if ( sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ) { + if ( versioninfo.wSuiteMask & VER_SUITE_DATACENTER ) + osproduct = "Datacenter x64 Edition"; + else if ( versioninfo.wSuiteMask & VER_SUITE_ENTERPRISE ) + osproduct = "Enterprise x64 Edition"; + else + osproduct = "Standard x64 Edition"; + } + else { + if ( versioninfo.wSuiteMask & VER_SUITE_DATACENTER ) + osproduct = "Datacenter Edition"; + else if ( versioninfo.wSuiteMask & VER_SUITE_ENTERPRISE ) + osproduct = "Enterprise Edition"; + else if ( versioninfo.wSuiteMask & VER_SUITE_BLADE ) + osproduct = "Web Edition"; + else + osproduct = "Standard Edition"; + } + } + else if ( versioninfo.dwMajorVersion == 5 && versioninfo.dwMinorVersion == 0) { + if ( versioninfo.wSuiteMask & VER_SUITE_DATACENTER ) + osproduct = "Datacenter Server"; + else if ( versioninfo.wSuiteMask & VER_SUITE_ENTERPRISE ) + osproduct = "Advanced Server"; + else + osproduct = "Server"; + } + else { /* NT 4.0 */ + if ( versioninfo.wSuiteMask & VER_SUITE_ENTERPRISE ) + osproduct = "Server 4.0, Enterprise Edition"; + else + osproduct = "Server 4.0"; + } + } /* \server type */ + } /* \product */ + + if (0==kde_gethostname(tmpnodename, tmpnodenamelen)) + strncpy(name->nodename, tmpnodename, 19); + else + name->nodename[0]=0; + + strncpy(name->version, __DATE__, 19); /** @todo ok? */ + + if (osproduct) + sprintf(name->release, "%d.%d (%s %s)", versioninfo.dwMajorVersion, + versioninfo.dwMinorVersion, ostype, osproduct); + else if (ostype) + sprintf(name->release, "%d.%d (%s)", versioninfo.dwMajorVersion, + versioninfo.dwMinorVersion, ostype); + else + sprintf(name->release, "%d.%d", versioninfo.dwMajorVersion, + versioninfo.dwMinorVersion); + + return 0; +} diff --git a/win/unistd.c b/win/unistd.c new file mode 100644 index 000000000..3252915a2 --- /dev/null +++ b/win/unistd.c @@ -0,0 +1,179 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#define _WINSOCKAPI_ /* skip winsock */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "win32_utils.h" + +KDEWIN32_EXPORT int getgroups(int size, gid_t list[]) +{ + /* TODO */ + return 0; +} + +KDEWIN32_EXPORT int readlink(const char *__path, char *__buf, int __buflen) +{ + if (!__path) { + errno = EINVAL; + return -1; + } + if ( (__buflen < 0) || ((int)strlen(__path)>(__buflen-1)) ) + { + errno = ENAMETOOLONG; + return -1; + } + if (access(__path, R_OK) == 0) { + /* ok, copy to buf */ + strncpy(__buf,__path,__buflen); + errno = 0; + return 0; + } + errno = ENOENT; + return -1; +} + +KDEWIN32_EXPORT int symlink(const char *__name1, const char *__name2) +{ + return fcopy(__name1, __name2); +} + +KDEWIN32_EXPORT int link(const char *__name1, const char *__name2) +{ + return fcopy(__name1, __name2); +} + +KDEWIN32_EXPORT int chown(const char *__path, uid_t __owner, gid_t __group) +{ + return 0; +} + +KDEWIN32_EXPORT int fchown(int __fd, uid_t __owner, gid_t __group ) +{ + return 0; +} + +KDEWIN32_EXPORT int lstat(const char *path, struct stat *sb) +{ + return _stat(path,(struct _stat*)sb); +} + +KDEWIN32_EXPORT int fchmod(int __fd, mode_t __mode) +{ + return 0; +} + + +/* Get the real user ID of the calling process. */ +KDEWIN32_EXPORT uid_t getuid() +{ + return 1; /* NOT A ROOT! */ +} + +/* Get the effective user ID of the calling process. */ +KDEWIN32_EXPORT uid_t geteuid (void) +{ + return 1; /* NOT A ROOT! */ +} + +/* Get the real group ID of the calling process. */ +KDEWIN32_EXPORT gid_t getgid (void) +{ + return 1; /* NOT A ROOT GR! */ +} + +/* Get the effective group ID of the calling process. */ +KDEWIN32_EXPORT gid_t getegid (void) +{ + return 1; /* NOT A ROOT GR! */ +} + +KDEWIN32_EXPORT int pipe(int *fd) +{ + /** @todo */ + return _pipe( fd, 256, O_BINARY ); /* OK? */ +} + +KDEWIN32_EXPORT pid_t fork(void) +{ + /** @todo */ + return -1; +} + +KDEWIN32_EXPORT pid_t setsid(void) +{ + /** @todo */ + return -1; +} + +typedef unsigned int size_t; + +/*#define INCL_WINSOCK_API_PROTOTYPES 0 +#include */ + +KDEWIN32_EXPORT int kde_gethostname(char *__name, size_t __len) +{ + size_t len = __len; + if (0==GetComputerNameA(__name, &len)) + return -1; + return 0; +} + +#define getlogin_buf_size 255 +char getlogin_buf[getlogin_buf_size+1]; + +KDEWIN32_EXPORT char* getlogin() +{ +/*! @todo make this reentrant!*/ + size_t size = sizeof(getlogin_buf); + *getlogin_buf = 0; + if (!GetUserNameA(getlogin_buf, (LPDWORD)&size)) + return 0; + return getlogin_buf; +} + +KDEWIN32_EXPORT void usleep(unsigned int usec) +{ + Sleep(usec/1000); +} + +KDEWIN32_EXPORT void sleep(unsigned int sec) +{ + Sleep(sec*1000); +} + +KDEWIN32_EXPORT long int random() +{ + return rand(); +} + +KDEWIN32_EXPORT int setreuid(uid_t ruid, uid_t euid) +{ + /*! @todo */ + return 0; +} + diff --git a/win/unistd.h b/win/unistd.h new file mode 100644 index 000000000..21fe8955e --- /dev/null +++ b/win/unistd.h @@ -0,0 +1,130 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Jaroslaw Staniek + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KDEWIN_UNISTD_H +#define _KDEWIN_UNISTD_H + +#include + +#include /* access(), etc.*/ +#include /* getpid(), etc.*/ + +/* include most headers here to avoid redefining gethostname() */ +#include +#include +#include +#include + +#define _WINSOCKAPI_ /* skip winsock */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 + +/* + from : */ +#define _IFMT 0170000 /* type of file */ +#define _IFDIR 0040000 /* directory */ +#define _IFCHR 0020000 /* character special */ +#define _IFBLK 0060000 /* block special */ +#define _IFREG 0100000 /* regular */ +#define _IFLNK 0120000 /* symbolic link */ +#define _IFSOCK 0140000 /* socket */ +#define _IFIFO 0010000 /* fifo */ + +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) +#define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) + + +KDEWIN32_EXPORT int chown(const char *__path, uid_t __owner, gid_t __group); + +KDEWIN32_EXPORT int fchmod(int __fd, mode_t __mode); + +KDEWIN32_EXPORT int fchown(int __fd, uid_t __owner, gid_t __group ); + +/* Get the real user ID of the calling process. */ +KDEWIN32_EXPORT uid_t getuid (void); + +/* Get the effective user ID of the calling process. */ +KDEWIN32_EXPORT uid_t geteuid (void); + +/* Get the real group ID of the calling process. */ +KDEWIN32_EXPORT gid_t getgid (void); + +/* Get the effective group ID of the calling process. */ +KDEWIN32_EXPORT gid_t getegid (void); + +KDEWIN32_EXPORT int getgroups(int size, gid_t list[]); + +/* On win32 we do not have fs-links, so simply 0 (success) is returned + when __path is accessible. It is then just copied to __buf. +*/ +KDEWIN32_EXPORT int readlink(const char *__path, char *__buf, int __buflen); + +/* just copies __name1 to __name2 */ +KDEWIN32_EXPORT int symlink(const char *__name1, const char *__name2); +/* just copies __name1 to __name2 */ +KDEWIN32_EXPORT int link(const char *__name1, const char *__name2); + +KDEWIN32_EXPORT char* realpath(const char *path,char *resolved_path); + +KDEWIN32_EXPORT int pipe(int *fd); + +KDEWIN32_EXPORT pid_t fork(void); + +KDEWIN32_EXPORT pid_t setsid(void); + +#undef gethostname +#define gethostname kde_gethostname + +KDEWIN32_EXPORT int kde_gethostname(char *__name, size_t __len); + +KDEWIN32_EXPORT unsigned alarm(unsigned __secs ); + +KDEWIN32_EXPORT char* getlogin(); + +KDEWIN32_EXPORT int fsync (int fd); + +KDEWIN32_EXPORT void usleep(unsigned int usec); +#define HAVE_USLEEP + +KDEWIN32_EXPORT void sleep(unsigned int sec); + +KDEWIN32_EXPORT long int random(); +#define HAVE_RANDOM + +#define HAVE_SETEUID +KDEWIN32_EXPORT int setreuid(uid_t ruid, uid_t euid); + +#ifdef __cplusplus +} +#endif + +#endif /* _KDEWIN_UNISTD_H */ diff --git a/win/utime.h b/win/utime.h new file mode 100644 index 000000000..33f0f4efc --- /dev/null +++ b/win/utime.h @@ -0,0 +1,22 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* jump to sys/ in your compiler's library */ + +#include diff --git a/win/win.pro b/win/win.pro new file mode 100644 index 000000000..d61d2c053 --- /dev/null +++ b/win/win.pro @@ -0,0 +1,54 @@ +TEMPLATE = lib +DEFINES += MAKE_KDEWIN32_LIB + +include( $(KDELIBS)/win/common.pro ) + +TARGET = kdewin32$$KDEBUG + +QMAKE_CXXFLAGS += /FI$(KDELIBS)/kdecore/kdelibs_export.h +QMAKE_CFLAGS += /FI$(KDELIBS)/kdecore/kdelibs_export.h + +system( moc qeventloopex.h -o moc/qeventloopex.moc ) + +WIN9x { + DEFINES += KDEWIN32_9x + + DESTDIR = $$KDELIBDESTDIR/win9x + + contains(KW_CONFIG,release) { + OBJECTS_DIR = 9x/obj_rel + } + !contains(KW_CONFIG,release) { + OBJECTS_DIR = 9x/obj + } +} + +SOURCES = \ +realpath.c \ +unistd.c \ +readdir.c \ +resource.c \ +pwd.c \ +fcntl.c \ +signal.c \ +uname.c \ +net.c \ +time.c \ +dummy.cpp \ +strndup.c \ +fsync.c \ +grp.c \ +syslog.c \ +win32_utils.c \ +win32_utils2.cpp \ +kde_file_win.c \ +mmap.c \ +getenv.c \ +qeventloopex.cpp \ +bootstrap.cpp + +#mkdir.c +#strlcpy.c \ +#strlcat.c \ + + diff --git a/win/win32_utils.c b/win/win32_utils.c new file mode 100644 index 000000000..975261e1d --- /dev/null +++ b/win/win32_utils.c @@ -0,0 +1,81 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +// helper functions + +#include "win32_utils.h" + +#include +#include +#include +#include +#include +#include + +//--------------------------------------------- +#define _fcopy_BUFLEN 1024*32 +int fcopy(const char *src, const char *dest) +{ + static char _fcopy_buf[_fcopy_BUFLEN]; //not reentrant! + FILE *in, *out; + int c_in=0, c_out=0; + int res=0; + + in=fopen(src, "rb"); + if (!in) + return fcopy_src_err; + out=fopen(dest, "wb"); + if (!out) + return fcopy_dest_err; + while (!feof(in) && !ferror(in) && !ferror(out)) { + c_in=fread(_fcopy_buf, 1, _fcopy_BUFLEN, in); + if (ferror(in) || c_in==0) { + break; + } + c_out=fwrite(_fcopy_buf, 1, c_in, out); + if (ferror(out) || c_in!=c_out) { + break; + } + } + + if (ferror(in)) { + res=fcopy_src_err; + } + else if (ferror(out)) { + res=fcopy_dest_err; + } + else if (c_in!=c_out) { + res=fcopy_dest_err; + } + fclose(in); + fclose(out); + return res; +} + +KDEWIN32_EXPORT +void win32_slashify(char *path, int maxlen) +{ + int len = 0; + if (!path) + return; + for (; *path && len < maxlen ; path++) + if ( *path == '\\' ) + *path = '/'; +} + diff --git a/win/win32_utils.h b/win/win32_utils.h new file mode 100644 index 000000000..341028209 --- /dev/null +++ b/win/win32_utils.h @@ -0,0 +1,96 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004-2005 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDE_WIN32_UTILS_H +#define KDE_WIN32_UTILS_H + +#include + +#include + +#ifdef __cplusplus +#include + +extern "C" { +#endif + +#define fcopy_src_err -1 +#define fcopy_dest_err -2 + +/** + Copies @p src file to @p dest file. + @return 0 on success, fcopy_src_err on source file error, + fcopy_dest_err on destination file error. +*/ +KDEWIN32_EXPORT int fcopy(const char *src, const char *dest); + +/** + Converts all backslashes to slashes in @p path. + Converting is stopped on a null character or at @p maxlen character. +*/ +KDEWIN32_EXPORT void win32_slashify(char *path, int maxlen); + +#ifdef __cplusplus +} + +/** + \return a value from MS Windows native registry. + @param key is usually one of HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE + constants defined in WinReg.h. + @param subKey is a registry subkey defined as a path to a registry folder, eg. + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" + ('\' delimiter must be used) + @param item is an item inside subKey or "" if default folder's value should be returned + @param ok if not null, will be set to true on success and false on failure +*/ +KDEWIN32_EXPORT QString getWin32RegistryValue(HKEY key, const QString& subKey, + const QString& item, bool *ok = 0); + +/** + \return a value from MS Windows native registry for shell folder \a folder. +*/ +inline QString getWin32ShellFoldersPath(const QString& folder) { + return getWin32RegistryValue(HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", folder); +} + +/** + Shows native MS Windows file property dialog for a file \a fileName. + Return true on success. Only works for local absolute paths. + Used by KPropertiesDialog, if possible. +*/ +KDEWIN32_EXPORT +bool showWin32FilePropertyDialog(const QString& fileName); + +/** + \return two-letter locale name (like "en" or "pl") taken from MS Windows native registry. + Useful when we don't want to rely on KSyCoCa. + Used e.g. by kbuildsycoca application. +*/ +KDEWIN32_EXPORT +QCString getWin32LocaleName(); + +/*! Temporary solutiuon + \return a KFileDialog-compatible filter string converted to QFileDialog compatible one. + This is temporary solution for kdelibs/win32... */ +KDEWIN32_EXPORT QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter); + +#endif //__cplusplus + +#endif diff --git a/win/win32_utils2.cpp b/win/win32_utils2.cpp new file mode 100644 index 000000000..fe693151e --- /dev/null +++ b/win/win32_utils2.cpp @@ -0,0 +1,154 @@ +/* + This file is part of the KDE libraries + Copyright (C) 2004-2005 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include + +#include +#include +#include + +KDEWIN32_EXPORT +QString getWin32RegistryValue(HKEY key, const QString& subKey, const QString& item, bool *ok) +{ +#define FAILURE \ + { if (ok) \ + *ok = false; \ + return QString::null; } + + if (!subKey) + FAILURE; + HKEY hKey; + TCHAR *lszValue; + DWORD dwType=REG_SZ; + DWORD dwSize; + if (ERROR_SUCCESS!=RegOpenKeyEx(key, subKey.ucs2(), NULL, KEY_READ, &hKey)) + FAILURE; + + if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, NULL, NULL, &dwSize)) + FAILURE; + + lszValue = new TCHAR[dwSize]; + + if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, &dwType, (LPBYTE)lszValue, &dwSize)) { + delete [] lszValue; + FAILURE; + } + RegCloseKey(hKey); + + QString res = QString::fromUcs2(lszValue); + delete [] lszValue; + return res; +} + +KDEWIN32_EXPORT +bool showWin32FilePropertyDialog(const QString& fileName) +{ + QString path_ = QDir::convertSeparators(QFileInfo(fileName).absFilePath()); + + SHELLEXECUTEINFO execInfo; + memset(&execInfo,0,sizeof(execInfo)); + execInfo.cbSize = sizeof(execInfo); + execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; + const QString verb("properties"); + execInfo.lpVerb = (TCHAR*)verb.ucs2(); + execInfo.lpFile = (TCHAR*)path_.ucs2(); + return ShellExecuteEx(&execInfo); +} + +KDEWIN32_EXPORT +QCString getWin32LocaleName() +{ + bool ok; + QString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International", + "Locale", &ok); + if (!ok) + return QCString(); + QString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", + localeNumber, &ok); + if (!ok) + return QCString(); + return localeName.latin1(); +} + +KDEWIN32_EXPORT +QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter) +{ + QString kde_filters = filter; + int pos; + // Strip the escape characters from + // escaped '/' characters. + + QString copy (kde_filters); + for (pos = 0; (pos = copy.find("\\/", pos)) != -1; ++pos) + copy.remove(pos, 1); + + // + //we need to convert KDE filter format to Qt format + //Qt format: "some text (*.first *.second)" or "All (*)" + //KDE format: "*.first *.second" or "*" + QStringList filters = QStringList::split("\n",kde_filters); + QString current; + QString converted; //finally - converted filter + for (QStringList::ConstIterator it = filters.constBegin(); it!=filters.constEnd();++it) { + current = *it; + QString new_f;//filter part + QString new_name;//filter name part + int p = (*it).find('|'); + if (p!=-1) { + new_f = current.left(p); + new_name = current.mid(p+1); + } + else { + new_f = current; + new_name = current; //nothing better + } + //remove (.....) from name + p=new_name.find('('); + int p2 = new_name.findRev(')'); + QString new_name1, new_name2; + if (p!=-1) + new_name1 = new_name.left(p); + if (p2!=-1) + new_name2 = new_name.mid(p2+1); + if (!new_name1.isEmpty() || !new_name2.isEmpty()) + new_name = new_name1.stripWhiteSpace() + " " + new_name2.stripWhiteSpace(); + new_name.replace('(',""); + new_name.replace(')',""); + new_name = new_name.stripWhiteSpace(); + + // make filters unique: remove uppercase extensions (case doesn't matter on win32, BTW) + QStringList allfiltersUnique; + QStringList origList( QStringList::split(" ", new_f) ); + for (QStringList::ConstIterator it = origList.constBegin(); + it!=origList.constEnd(); ++it) + { + if ((*it) == (*it).lower()) + allfiltersUnique += *it; + } + + if (!converted.isEmpty()) + converted += ";;"; + + converted += (new_name + " (" + allfiltersUnique.join(" ") + ")"); + } + return converted; +} diff --git a/win/zlib.pro b/win/zlib.pro new file mode 100644 index 000000000..899d54c97 --- /dev/null +++ b/win/zlib.pro @@ -0,0 +1,10 @@ + +# adds includes and zlib library (Qt's zlib or external zlib) + +exists( $(KDELIBS)/win/3rdparty/zlib/zlib.h ) { + INCLUDEPATH += $(KDELIBS)/win/3rdparty/zlib + LIBS += $$KDELIBDESTDIR\zdll.lib +} +!exists( $(KDELIBS)/win/3rdparty/zlib/zlib.h ) { + INCLUDEPATH += $(QTDIR)/src/3rdparty/zlib +} -- cgit v1.2.1