├── README.md ├── getopt ├── getopt-vc9.vcproj ├── getopt.c ├── getopt.h ├── getopt.vcproj ├── getopt_long.c └── getopt_long.h ├── include ├── std │ ├── algorithm.h │ ├── functional.h │ ├── hash.h │ ├── hash_map.h │ ├── hash_set.h │ ├── iterator.h │ ├── list.h │ ├── map.h │ ├── numeric.h │ ├── set.h │ ├── stdexcept.h │ ├── string.h │ └── vector.h ├── stdext.h ├── stdext │ ├── AOP.h │ ├── Algorithm.h │ ├── Archive.h │ ├── Array.h │ ├── Basic.h │ ├── CArray.h │ ├── CharType.h │ ├── Cons.h │ ├── Counter.h │ ├── Debug.h │ ├── Deque.h │ ├── Digest.h │ ├── FileBuf.h │ ├── Hash.h │ ├── HashMap.h │ ├── HashSet.h │ ├── LargeInteger.h │ ├── LinkLib.h │ ├── List.h │ ├── Log.h │ ├── MMap.h │ ├── Map.h │ ├── Memory.h │ ├── OpType.h │ ├── Platform.h │ ├── Queue.h │ ├── Rand.h │ ├── Registry.h │ ├── Relation.h │ ├── ScopeDebug.h │ ├── Search.h │ ├── Set.h │ ├── StaticAlgo.h │ ├── Storage.h │ ├── String.h │ ├── TestCase.h │ ├── ThreadModel.h │ ├── Tuple.h │ ├── TypedPtrArray.h │ ├── Variant.h │ ├── aop │ │ ├── Event.h │ │ ├── EventContainer.h │ │ └── Interface.h │ ├── archive │ │ ├── Basic.h │ │ ├── Binary.h │ │ ├── MMapArchive.h │ │ ├── Mem.h │ │ ├── MemArchive.h │ │ ├── Posix.h │ │ ├── ReadArchive.h │ │ ├── Record.h │ │ ├── Stdio.h │ │ ├── Stream.h │ │ ├── Text.h │ │ ├── WinReg.h │ │ ├── WriteArchive.h │ │ └── posix │ │ │ └── Config.h │ ├── boost │ │ ├── Memory.h │ │ └── Tuple.h │ ├── codepage │ │ ├── CP1252.h │ │ └── UTF8.h │ ├── detail │ │ └── GlobalVar.h │ ├── digest │ │ ├── MD4.h │ │ ├── MD5.h │ │ ├── SHA1.h │ │ ├── md4 │ │ │ └── md4.h │ │ ├── md5 │ │ │ ├── MD5Checksum.h │ │ │ ├── MD5ChecksumDefines.h │ │ │ └── MD5ChecksumImpl.h │ │ └── sha1 │ │ │ ├── license.txt │ │ │ ├── sha1.h │ │ │ └── sha1.inl │ ├── filebuf │ │ ├── AutoBuffer.h │ │ ├── MapFileBuf.h │ │ ├── Stdio.h │ │ └── WinFile.h │ ├── int │ │ ├── Builder.h │ │ └── Traits.h │ ├── kmp │ │ ├── Finder.h │ │ ├── RefFinder.h │ │ └── TestFinder.h │ ├── mapfile │ │ ├── MMap.h │ │ └── WinFileMapping.h │ ├── memory │ │ ├── RecycleBuffer.h │ │ └── TlsPools.h │ ├── mmap │ │ ├── AccessBuffer.h │ │ ├── FileMapping.h │ │ └── MapFile.h │ ├── msvcrt.h │ ├── msvcrt │ │ ├── atlconv.h │ │ ├── crtdbg.h │ │ └── specstrings.h │ ├── p │ │ ├── HashMap.h │ │ ├── HashSet.h │ │ └── HashTable.h │ ├── patch │ │ ├── string.h │ │ └── vc6 │ │ │ └── string.h │ ├── posix │ │ ├── dirent.h │ │ ├── dirent │ │ │ └── windows.h │ │ ├── getopt.h │ │ ├── popen │ │ │ └── windows.h │ │ ├── stdio.h │ │ ├── sys │ │ │ └── stat.h │ │ ├── time.h │ │ └── unistd.h │ ├── pthread.h │ ├── registry │ │ └── WinRegistry.h │ ├── scopedbg │ │ ├── CheckException.h │ │ ├── ErrorGuard.h │ │ └── ScopeLog.h │ ├── search │ │ ├── Basic.h │ │ ├── KMP.h │ │ ├── RefFinder.h │ │ └── ShiftOr.h │ ├── sgi │ │ ├── algorithm.h │ │ ├── config.h │ │ ├── deque.h │ │ ├── functional.h │ │ ├── gcc │ │ │ ├── algorithm.h │ │ │ ├── functional.h │ │ │ ├── hashtable.h │ │ │ ├── iterator.h │ │ │ ├── numeric.h │ │ │ └── string.h │ │ ├── hash_map.h │ │ ├── hash_set.h │ │ ├── iterator.h │ │ ├── list.h │ │ ├── numeric.h │ │ ├── rope.h │ │ ├── string.h │ │ ├── vc6 │ │ │ └── string.h │ │ ├── vc8 │ │ │ └── iterator.h │ │ └── vector.h │ ├── tchar.h │ ├── tchar │ │ ├── itoa.h │ │ ├── makepath.h │ │ ├── memop.h │ │ ├── splitpath.h │ │ ├── strcat.h │ │ ├── strchr.h │ │ ├── strcmp.h │ │ ├── strcspn.h │ │ ├── strdup.h │ │ ├── stricmp.h │ │ ├── strlen.h │ │ ├── strlwr.h │ │ ├── strncmp.h │ │ ├── strncpy.h │ │ ├── strnicmp.h │ │ ├── strrchr.h │ │ ├── strspn.h │ │ ├── strstr.h │ │ └── strupr.h │ ├── text │ │ ├── Append.h │ │ ├── BasicAlgo.h │ │ ├── BasicString.h │ │ ├── Binary.h │ │ ├── CString.h │ │ ├── Cast.h │ │ ├── Encoding.h │ │ ├── Format.h │ │ ├── Range.h │ │ ├── Rope.h │ │ ├── StringAlgo.h │ │ ├── StringBuilder.h │ │ ├── TextPool.h │ │ ├── concat │ │ │ └── algo.h │ │ ├── format │ │ │ ├── formatter.h │ │ │ ├── printf.h │ │ │ ├── printype.h │ │ │ ├── put.h │ │ │ └── str.h │ │ ├── rope │ │ │ ├── CharProxy.h │ │ │ ├── Rope.h │ │ │ ├── RopeImpl.h │ │ │ ├── RopeIter.h │ │ │ ├── RopeRep.h │ │ │ └── SequenceBuffer.h │ │ └── sgi │ │ │ └── Rope.h │ ├── thread │ │ ├── Basic.h │ │ ├── Condition.h │ │ ├── Event.h │ │ ├── Mutex.h │ │ ├── RefCount.h │ │ ├── Semaphore.h │ │ ├── TLS.h │ │ └── Thread.h │ ├── time │ │ └── timespec.h │ ├── vc │ │ ├── declspec.h │ │ ├── property.h │ │ └── uuidof.h │ ├── winapi │ │ ├── atomic │ │ │ ├── atomic_builtins.h │ │ │ ├── solaris.h │ │ │ └── windows.h │ │ ├── guid │ │ │ └── CoCreateGuid.h │ │ ├── objbase.h │ │ ├── objidl.h │ │ ├── ole2.h │ │ ├── oleauto.h │ │ ├── posix │ │ │ ├── pthread.h │ │ │ └── time.h │ │ ├── shlwapi.h │ │ ├── winbase.h │ │ ├── windef.h │ │ ├── winerror.h │ │ ├── winnls.h │ │ └── wtypes.h │ └── winsdk.h └── stlpatch.h └── lib └── shlwapi.lib /README.md: -------------------------------------------------------------------------------- 1 | My C/C++ Open Source Projects 2 | ===== 3 | 4 | ## winx - A C++ GUI Library for Windows 5 | 6 | It was open sourced on [Sourceforge](https://sourceforge.net/projects/winx/) on 2006-08-14. 7 | 8 | * https://sourceforge.net/projects/winx/ 9 | * https://code.google.com/archive/p/winx/ 10 | * https://github.com/xushiwei/winx 11 | 12 | ## stdext - A C++ STL Extensions Libary 13 | 14 | It was originally part of `winx` and became an independent open source project on 2008-01-23. 15 | 16 | * https://code.google.com/archive/p/stdext/ 17 | * https://github.com/xushiwei/stdext 18 | 19 | ## memory - C++ Memory Management Innovation: GC Allocator 20 | 21 | It was originally part of `stdext` and became an independent open source project on 2008-04-28. 22 | 23 | Most of the C++ programmers do not benefit from Garbage Collection technique (GC). Here is a new memory management technique named GC Allocator (Note it is not GC). 24 | 25 | * https://www.codeproject.com/KB/cpp/gc-allocator.aspx 26 | * http://svn.boost.org/svn/boost/sandbox/memory/ (not available) 27 | * https://github.com/xushiwei/memory 28 | 29 | ## tpl - Text Processing Language 30 | 31 | TPL is a Text Processing Library/Language. 32 | 33 | It was open sourced on [Google Code](https://code.google.com/archive/p/libtpl/) on 2008-06-21. 34 | 35 | * https://code.google.com/archive/p/libtpl/ 36 | * https://github.com/xushiwei/tpl 37 | -------------------------------------------------------------------------------- /getopt/getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef GETOPT_H 2 | #define GETOPT_H 3 | 4 | extern "C" { 5 | int getopt(int argc, char * const argv[], const char *optstring); 6 | extern char *optarg; 7 | extern int optind, opterr, optopt; 8 | #include "getopt_long.h" 9 | } 10 | 11 | #endif /* GETOPT_H */ 12 | -------------------------------------------------------------------------------- /getopt/getopt_long.h: -------------------------------------------------------------------------------- 1 | /* The Regents of the University of California. All rights reserved. 2 | * 3 | * Portions Copyright (c) 2003-2007, PostgreSQL Global Development Group 4 | * 5 | * $PostgreSQL: pgsql/src/include/getopt_long.h,v 1.8 2007/01/05 22:19:50 momjian Exp $ 6 | */ 7 | #ifndef GETOPT_LONG_H 8 | #define GETOPT_LONG_H 9 | 10 | #ifdef HAVE_GETOPT_H 11 | #include 12 | #endif 13 | 14 | /* These are picked up from the system's getopt() facility. */ 15 | extern int opterr; 16 | extern int optind; 17 | extern int optopt; 18 | extern char *optarg; 19 | 20 | /* Some systems have this, otherwise you need to define it somewhere. */ 21 | extern int optreset; 22 | 23 | #ifndef HAVE_STRUCT_OPTION 24 | 25 | struct option 26 | { 27 | const char *name; 28 | int has_arg; 29 | int *flag; 30 | int val; 31 | }; 32 | 33 | #define no_argument 0 34 | #define required_argument 1 35 | #endif 36 | 37 | #ifndef HAVE_GETOPT_LONG 38 | 39 | extern int getopt_long(int argc, char *const argv[], 40 | const char *optstring, 41 | const struct option * longopts, int *longindex); 42 | #endif 43 | 44 | #endif /* GETOPT_LONG_H */ -------------------------------------------------------------------------------- /include/std/algorithm.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/algorithm.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: algorithm.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_ALGORITHM_H 20 | #define STD_ALGORITHM_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_ALGORITHM 30 | #include "../../../stl/algorithm" 31 | #endif 32 | #else 33 | #if !defined(_ALGORITHM_) && !defined(_ALGORITHM) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | // $Log: algorithm.h,v $ 40 | 41 | #endif /* STD_ALGORITHM_H */ 42 | -------------------------------------------------------------------------------- /include/std/functional.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/functional.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: functional.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_FUNCTIONAL_H 20 | #define STD_FUNCTIONAL_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // functional.h 28 | 29 | #if defined(X_STL_SGI) 30 | #ifndef __SGI_STL_FUNCTIONAL 31 | #include "../../../stl/functional" 32 | #endif 33 | #else 34 | #if !defined(_FUNCTIONAL_) && !defined(_FUNCTIONAL) 35 | #include 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: functional.h,v $ 41 | 42 | #endif /* STD_FUNCTIONAL_H */ 43 | -------------------------------------------------------------------------------- /include/std/hash.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/hash.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: hash.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_HASH_H 20 | #define STD_HASH_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_NET) 29 | #ifndef _HASH_MAP_ 30 | #include 31 | #endif 32 | #elif defined(X_STL_GCC) 33 | #ifndef _HASH_FUN_H 34 | #include 35 | #endif 36 | #elif defined(NO_SGISTL) 37 | #define WINX_NO_HASH_ 38 | #else 39 | #ifndef __SGI_HASH_MAP_H__ 40 | #include "../stdext/sgi/hash_map.h" 41 | #endif 42 | #endif 43 | 44 | // ------------------------------------------------------------------------- 45 | // $Log: hash.h,v $ 46 | 47 | #endif /* STD_HASH_H */ 48 | -------------------------------------------------------------------------------- /include/std/hash_map.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/hash_map.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: hash_map.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_HASH_MAP_H 20 | #define STD_HASH_MAP_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_NET) 29 | #ifndef _HASH_MAP_ 30 | #include 31 | #endif 32 | #elif defined(X_STL_GCC) 33 | #ifndef _HASH_MAP 34 | #include 35 | #endif 36 | #elif defined(NO_SGISTL) 37 | #define WINX_NO_HASH_MAP_ 38 | #else 39 | #ifndef __SGI_HASH_MAP_H__ 40 | #include "../stdext/sgi/hash_map.h" 41 | #endif 42 | #endif 43 | 44 | // ------------------------------------------------------------------------- 45 | // $Log: hash_map.h,v $ 46 | 47 | #endif /* STD_HASH_MAP_H */ 48 | -------------------------------------------------------------------------------- /include/std/hash_set.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/hash_set.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: hash_set.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_HASH_SET_H 20 | #define STD_HASH_SET_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_NET) 29 | #ifndef _HASH_SET_ 30 | #include 31 | #endif 32 | #elif defined(X_STL_GCC) 33 | #ifndef _HASH_SET 34 | #include 35 | #endif 36 | #elif defined(NO_SGISTL) 37 | #define WINX_NO_HASH_SET_ 38 | #else 39 | #ifndef __SGI_HASH_SET_H__ 40 | #include "../stdext/sgi/hash_set.h" 41 | #endif 42 | #endif 43 | 44 | // ------------------------------------------------------------------------- 45 | // $Log: hash_set.h,v $ 46 | 47 | #endif /* STD_HASH_SET_H */ 48 | -------------------------------------------------------------------------------- /include/std/list.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/list.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: list.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_LIST_H 20 | #define STD_LIST_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_LIST_H 30 | #include "../../../stl/list.h" 31 | #endif 32 | #else 33 | #if !defined(_LIST_) && !defined(_LIST) 34 | #include 35 | #endif 36 | #endif 37 | 38 | #if defined(X_STL_GCC) && !defined(X_STL_SGI) 39 | #if !defined(_SLIST) 40 | #include 41 | #endif 42 | #elif defined(NO_SGISTL) 43 | #define _WINX_NO_SLIST 44 | #else 45 | #ifndef __SGI_STL_SLIST_H 46 | #include "../stdext/sgi/list.h" 47 | #endif 48 | #endif 49 | 50 | // ------------------------------------------------------------------------- 51 | // $Log: list.h,v $ 52 | 53 | #endif /* STD_LIST_H */ 54 | -------------------------------------------------------------------------------- /include/std/map.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/map.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: map.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_MAP_H 20 | #define STD_MAP_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_MAP_H 30 | #include "../../../stl/map.h" 31 | #endif 32 | #else 33 | #if !defined(_MAP_) && !defined(_GLIBCXX_MAP) && !defined(_MAP) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | // $Log: map.h,v $ 40 | 41 | #endif /* STD_MAP_H */ 42 | -------------------------------------------------------------------------------- /include/std/numeric.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/numeric.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: numeric.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_NUMERIC_H 20 | #define STD_NUMERIC_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_NUMERIC 30 | #include "../../../stl/numeric" 31 | #endif 32 | #else 33 | #if !defined(_NUMERIC_) && !defined(_NUMERIC) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | // $Log: numeric.h,v $ 40 | 41 | #endif /* STD_NUMERIC_H */ 42 | -------------------------------------------------------------------------------- /include/std/set.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/set.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: set.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_SET_H 20 | #define STD_SET_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_SET_H 30 | #include "../../../stl/set.h" 31 | #endif 32 | #else 33 | #if !defined(_SET_) && !defined(_SET) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | // $Log: set.h,v $ 40 | 41 | #endif /* STD_SET_H */ 42 | -------------------------------------------------------------------------------- /include/std/stdexcept.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/stdexcept.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: stdexcept.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_STDEXCEPT_H 20 | #define STD_STDEXCEPT_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STDEXCEPT 30 | #include "../../../stl/stdexcept" 31 | #endif 32 | #else 33 | #if !defined(_STDEXCEPT_) && !defined(_STDEXCEPT) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | // $Log: stdexcept.h,v $ 40 | 41 | #endif /* STD_STDEXCEPT_H */ 42 | -------------------------------------------------------------------------------- /include/std/string.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/string.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: string.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_STRING_H 20 | #define STD_STRING_H 21 | 22 | #ifndef STLPATCH_H 23 | #include "../stlpatch.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_STRING 30 | #include "../../../stl/string" 31 | #endif 32 | #else 33 | #if !defined(_STRING_) && !defined(_STRING) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | 40 | #endif /* STD_STRING_H */ 41 | -------------------------------------------------------------------------------- /include/std/vector.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: std/vector.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: vector.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STD_VECTOR_H 20 | #define STD_VECTOR_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../stdext/Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_STL_SGI) 29 | #ifndef __SGI_STL_VECTOR_H 30 | #include "../../../stl/vector.h" 31 | #endif 32 | #else 33 | #if !defined(_VECTOR_) && !defined(_VECTOR) 34 | #include 35 | #endif 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | 40 | #endif /* STD_VECTOR_H */ 41 | -------------------------------------------------------------------------------- /include/stdext.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 14:22:12 16 | // 17 | // $Id: stdext.h,v 1.3 2007/01/10 09:38:33 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_H 20 | #define STDEXT_H 21 | 22 | #if (0) 23 | #define STD_NO_TASKALLOC 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #ifndef STLPATCH_H 29 | #include "stlpatch.h" 30 | #endif 31 | 32 | #ifndef STDEXT_BASIC_H 33 | #include "stdext/Basic.h" 34 | #endif 35 | 36 | #ifndef STDEXT_TESTCASE_H 37 | #include "stdext/TestCase.h" 38 | #endif 39 | 40 | #ifndef STDEXT_ARRAY_H 41 | #include "stdext/Array.h" 42 | #endif 43 | 44 | #ifndef STDEXT_STORAGE_H 45 | #include "stdext/Storage.h" 46 | #endif 47 | 48 | #ifndef STDEXT_LOG_H 49 | #include "stdext/Log.h" 50 | #endif 51 | 52 | #ifndef STDEXT_COUNTER_H 53 | #include "stdext/Counter.h" 54 | #endif 55 | 56 | #ifndef STDEXT_MEMORY_H 57 | #include "stdext/Memory.h" 58 | #endif 59 | 60 | #ifndef STDEXT_CHARTYPE_H 61 | #include "stdext/CharType.h" 62 | #endif 63 | 64 | #ifndef STDEXT_STRING_H 65 | #include "stdext/String.h" 66 | #endif 67 | 68 | #ifndef STDEXT_TYPEDPTRARRAY_H 69 | #include "stdext/TypedPtrArray.h" 70 | #endif 71 | 72 | #ifndef STDEXT_FILEBUF_H 73 | #include "stdext/FileBuf.h" 74 | #endif 75 | 76 | // ------------------------------------------------------------------------- 77 | // $Log: stdext.h,v $ 78 | 79 | #endif /* STDEXT_H */ 80 | -------------------------------------------------------------------------------- /include/stdext/AOP.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/AOP.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-13 9:41:58 16 | // Description: AOP - Aspect Oriented Programming 17 | // 18 | // $Id: $ 19 | // -----------------------------------------------------------------------*/ 20 | #ifndef STDEXT_AOP_H 21 | #define STDEXT_AOP_H 22 | 23 | // ------------------------------------------------------------------------- 24 | 25 | #ifndef STDEXT_AOP_INTERFACE_H 26 | #include "aop/Interface.h" 27 | #endif 28 | 29 | #ifndef STDEXT_AOP_EVENT_H 30 | #include "aop/Event.h" 31 | #endif 32 | 33 | #ifndef STDEXT_AOP_EVENTCONTAINER_H 34 | #include "aop/EventContainer.h" 35 | #endif 36 | 37 | // ------------------------------------------------------------------------- 38 | // $Log: $ 39 | 40 | #endif /* STDEXT_AOP_H */ 41 | -------------------------------------------------------------------------------- /include/stdext/Algorithm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/Algorithm.h -------------------------------------------------------------------------------- /include/stdext/Archive.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/Archive.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-25 9:47:19 16 | // 17 | // $Id: Archive.h,v 1.2 2006/11/30 03:19:17 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_ARCHIVE_H 20 | #define STDEXT_ARCHIVE_H 21 | 22 | #if (0) 23 | #define WINX_STREAM_ARCHIVE 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #ifndef STDEXT_ARCHIVE_BASIC_H 29 | #include "archive/Basic.h" 30 | #endif 31 | 32 | #ifndef STDEXT_ARCHIVE_BINARY_H 33 | #include "archive/Binary.h" 34 | #endif 35 | 36 | #ifndef STDEXT_ARCHIVE_TEXT_H 37 | #include "archive/Text.h" 38 | #endif 39 | 40 | #ifndef STDEXT_ARCHIVE_WRITEARCHIVE_H 41 | #include "archive/WriteArchive.h" 42 | #endif 43 | 44 | #ifndef STDEXT_ARCHIVE_READARCHIVE_H 45 | #include "archive/ReadArchive.h" 46 | #endif 47 | 48 | #ifndef STDEXT_ARCHIVE_STDIO_H 49 | #include "archive/Stdio.h" 50 | #endif 51 | 52 | #ifndef STDEXT_ARCHIVE_POSIX_H 53 | #include "archive/Posix.h" 54 | #endif 55 | 56 | #ifndef STDEXT_ARCHIVE_MEMARCHIVE_H 57 | #include "archive/MemArchive.h" 58 | #endif 59 | 60 | #ifndef STDEXT_ARCHIVE_MMAPARCHIVE_H 61 | #include "archive/MMapArchive.h" 62 | #endif 63 | 64 | #ifndef STDEXT_ARCHIVE_MEM_H 65 | #include "archive/Mem.h" 66 | #endif 67 | 68 | #ifndef STDEXT_ARCHIVE_RECORD_H 69 | #include "archive/Record.h" 70 | #endif 71 | 72 | #if defined(X_OS_WINDOWS) 73 | 74 | #if defined(WINX_STREAM_ARCHIVE) 75 | #ifndef STDEXT_ARCHIVE_STREAM_H 76 | #include "archive/Stream.h" 77 | #endif 78 | #endif // defined(WINX_STREAM_ARCHIVE) 79 | 80 | #ifndef STDEXT_ARCHIVE_WINREG_H 81 | #include "archive/WinReg.h" 82 | #endif 83 | 84 | #endif 85 | 86 | // ------------------------------------------------------------------------- 87 | // class FileReader/FileWriter 88 | 89 | NS_STDEXT_BEGIN 90 | 91 | typedef PosixAdapter FileDirectReader; 92 | typedef PosixReadArchive FileReadArchive; 93 | typedef FileReadArchive FileReader; 94 | 95 | typedef PosixAdapter FileDirectWriter; 96 | typedef PosixWriteArchive FileWriteArchive; 97 | typedef FileWriteArchive FileWriter; 98 | 99 | NS_STDEXT_END 100 | 101 | // ------------------------------------------------------------------------- 102 | // $Log: Archive.h,v $ 103 | 104 | #endif /* STDEXT_ARCHIVE_H */ 105 | -------------------------------------------------------------------------------- /include/stdext/Counter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/Counter.h -------------------------------------------------------------------------------- /include/stdext/Digest.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/Digest.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:48:49 16 | // 17 | // $Id: Digest.h,v 1.3 2007/01/10 09:35:16 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_DIGEST_H 20 | #define STDEXT_DIGEST_H 21 | 22 | #ifndef STDEXT_DIGEST_MD4_H 23 | #include "digest/MD4.h" 24 | #endif 25 | 26 | #ifndef STDEXT_DIGEST_MD5_H 27 | #include "digest/MD5.h" 28 | #endif 29 | 30 | #ifndef STDEXT_DIGEST_SHA1_H 31 | #include "digest/SHA1.h" 32 | #endif 33 | 34 | #ifndef STDEXT_TEXT_BINARY_H 35 | #include "text/Binary.h" 36 | #endif 37 | 38 | NS_STDEXT_BEGIN 39 | 40 | // ------------------------------------------------------------------------- 41 | // md5str, md4str, sha1str 42 | 43 | inline const char* winx_call md5str(char digest[33], const void* buf, size_t bytes) 44 | { 45 | BYTE v[16]; 46 | md5(buf, bytes, v); 47 | bin2hex(digest, v, 16); 48 | digest[32] = '\0'; 49 | return digest; 50 | } 51 | 52 | inline const char* winx_call md4str(char digest[33], const void* buf, size_t bytes) 53 | { 54 | BYTE v[16]; 55 | md4(buf, bytes, v); 56 | bin2hex(digest, v, 16); 57 | digest[32] = '\0'; 58 | return digest; 59 | } 60 | 61 | inline const char* winx_call sha1str(char digest[41], const void* buf, size_t bytes) 62 | { 63 | BYTE v[20]; 64 | sha1(buf, bytes, v); 65 | bin2hex(digest, v, 20); 66 | digest[40] = '\0'; 67 | return digest; 68 | } 69 | 70 | // ------------------------------------------------------------------------- 71 | 72 | NS_STDEXT_END 73 | 74 | #endif /* STDEXT_DIGEST_H */ 75 | -------------------------------------------------------------------------------- /include/stdext/FileBuf.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/FileBuf.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-9-25 15:33:27 16 | // 17 | // $Id: FileBuf.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_FILEBUF_H 20 | #define STDEXT_FILEBUF_H 21 | 22 | #if defined(WINX_FILEBUF_USE_WINFILE) 23 | #include "filebuf/WinFile.h" 24 | #endif 25 | 26 | #ifndef STDEXT_FILEBUF_MAPFILEBUF_H 27 | #include "filebuf/MapFileBuf.h" 28 | #endif 29 | 30 | #ifndef STDEXT_FILEBUF_STDIO_H 31 | #include "filebuf/Stdio.h" 32 | #endif 33 | 34 | NS_STDEXT_BEGIN 35 | 36 | // ------------------------------------------------------------------------- 37 | // class FileBuf 38 | 39 | #if defined(X_OS_WINDOWS) && defined(WINX_FILEBUF_USE_WINFILE) 40 | 41 | typedef WinFileBuf FileBuf; 42 | 43 | #else 44 | 45 | typedef FILEFileBuf FileBuf; 46 | 47 | #endif 48 | 49 | // ------------------------------------------------------------------------- 50 | // $Log: FileBuf.h,v $ 51 | 52 | NS_STDEXT_END 53 | 54 | #endif /* STDEXT_FILEBUF_H */ 55 | 56 | -------------------------------------------------------------------------------- /include/stdext/LinkLib.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/LinkLib.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2003-10-14 17:57:09 16 | // 17 | // $Id: LinkLib.h,v 1.1 2006/11/30 08:45:42 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_LINKLIB_H 20 | #define STDEXT_LINKLIB_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef BOOST_MEMORY_LINKLIB_HPP 25 | #include "../../memory/boost/memory/linklib.hpp" 26 | #endif 27 | 28 | // ------------------------------------------------------------------------- 29 | // $Log: LinkLib.h,v $ 30 | 31 | #endif /* STDEXT_LINKLIB_H */ 32 | -------------------------------------------------------------------------------- /include/stdext/MMap.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/MMap.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2007-1-31 10:57:34 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_MMAP_H 20 | #define STDEXT_MMAP_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef STDEXT_MMAP_MAPFILE_H 25 | #include "mmap/MapFile.h" 26 | #endif 27 | 28 | // ------------------------------------------------------------------------- 29 | 30 | #ifndef STDEXT_MMAP_FILEMAPPING_H 31 | #include "mmap/FileMapping.h" 32 | #endif 33 | 34 | // ------------------------------------------------------------------------- 35 | // $Log: $ 36 | 37 | #endif /* STDEXT_MMAP_H */ 38 | 39 | -------------------------------------------------------------------------------- /include/stdext/Queue.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/Queue.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-12-20 15:29:13 16 | // 17 | // $Id: Queue.h,v 1.2 2007/01/10 09:33:50 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_QUEUE_H 20 | #define STDEXT_QUEUE_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // class LimitedQueue 30 | 31 | template 32 | class LimitedQueue 33 | { 34 | private: 35 | Type* m_data; 36 | size_t m_i; 37 | size_t m_size; 38 | size_t const nElement; 39 | 40 | LimitedQueue(const LimitedQueue&); 41 | void operator=(const LimitedQueue&); 42 | 43 | public: 44 | typedef Type value_type; 45 | typedef size_t size_type; 46 | 47 | typedef Type& reference; 48 | typedef const Type& const_reference; 49 | 50 | public: 51 | LimitedQueue(Type data[], size_t n) 52 | : m_data(data), nElement(n), 53 | m_i(0), m_size(0) 54 | { 55 | } 56 | 57 | public: 58 | void winx_call clear() { m_size = 0; } 59 | 60 | size_type winx_call capacity() const { return nElement; } 61 | size_type winx_call size() const { return m_size; } 62 | bool winx_call empty() const { return m_size == 0; } 63 | bool winx_call full() const { return m_size >= nElement; } 64 | 65 | reference winx_call front() { return m_data[m_i]; } 66 | const_reference winx_call front() const { return m_data[m_i]; } 67 | 68 | reference winx_call back() { return m_data[(m_i + m_size - 1) % nElement]; } 69 | const_reference winx_call back() const { return m_data[(m_i + m_size - 1) % nElement]; } 70 | 71 | void winx_call push(const_reference val) 72 | { 73 | WINX_ASSERT(!full()); 74 | 75 | m_data[(m_i + m_size) % nElement] = val; 76 | ++m_size; 77 | } 78 | 79 | void winx_call pop() 80 | { 81 | WINX_ASSERT(!empty()); 82 | 83 | m_i = (m_i + 1) % nElement; 84 | --m_size; 85 | } 86 | 87 | void winx_call copy(const LimitedQueue& from) 88 | { 89 | m_size = from.m_size; 90 | m_i = from.m_i; 91 | std::copy(from.m_data, from.m_data + nElement, m_data); 92 | } 93 | }; 94 | 95 | // ------------------------------------------------------------------------- 96 | 97 | NS_STDEXT_END 98 | 99 | #endif /* STDEXT_QUEUE_H */ 100 | -------------------------------------------------------------------------------- /include/stdext/Rand.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/Rand.h -------------------------------------------------------------------------------- /include/stdext/Registry.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/Registry.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2007-2-7 16:20:30 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_REGISTRY_H 20 | #define STDEXT_REGISTRY_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #if !defined(STD_NO_WINSDK) 25 | 26 | #ifndef STDEXT_REGISTRY_WINREGISTRY_H 27 | #include "registry/WinRegistry.h" 28 | #endif 29 | 30 | #endif 31 | 32 | // ------------------------------------------------------------------------- 33 | 34 | #endif /* STDEXT_REGISTRY_H */ 35 | -------------------------------------------------------------------------------- /include/stdext/ScopeDebug.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/ScopeDebug.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Contributor: sting.feng@gmail.com 16 | // Date: 2007-2-3 17:32:38 17 | // 18 | // $Id: $ 19 | // -----------------------------------------------------------------------*/ 20 | #ifndef STDEXT_SCOPEDEBUG_H 21 | #define STDEXT_SCOPEDEBUG_H 22 | 23 | // ------------------------------------------------------------------------- 24 | 25 | #if defined(_WIN32) 26 | 27 | #ifndef STDEXT_SCOPEDBG_SCOPELOG_H 28 | #include "scopedbg/ScopeLog.h" 29 | #endif 30 | 31 | #ifndef STDEXT_SCOPEDBG_ERRORGUARD_H 32 | #include "scopedbg/ErrorGuard.h" 33 | #endif 34 | 35 | #endif 36 | 37 | // ------------------------------------------------------------------------- 38 | // $Log: $ 39 | 40 | #endif /* STDEXT_SCOPEDEBUG_H */ 41 | -------------------------------------------------------------------------------- /include/stdext/Search.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/Search.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2008-8-8 20:30:40 16 | // 17 | // $Id: Search.h 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_SEARCH_H 20 | #define STDEXT_SEARCH_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef STDEXT_SEARCH_BASIC_H 25 | #include "search/Basic.h" 26 | #endif 27 | 28 | #ifndef STDEXT_SEARCH_KMP_H 29 | #include "search/RefFinder.h" 30 | #endif 31 | 32 | #ifndef STDEXT_SEARCH_KMP_H 33 | #include "search/KMP.h" 34 | #endif 35 | 36 | #ifndef STDEXT_SEARCH_SHIFTOR_H 37 | #include "search/ShiftOr.h" 38 | #endif 39 | 40 | // ------------------------------------------------------------------------- 41 | // $Log: Search.h,v $ 42 | 43 | #endif /* STDEXT_SEARCH_H */ 44 | -------------------------------------------------------------------------------- /include/stdext/String.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/String.h -------------------------------------------------------------------------------- /include/stdext/ThreadModel.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/ThreadModel.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-9-3 2:18:33 16 | // 17 | // $Id: ThreadModel.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_THREADMODEL_H 20 | #define STDEXT_THREADMODEL_H 21 | 22 | #ifndef STDEXT_THREAD_REFCOUNT_H 23 | #include "thread/RefCount.h" 24 | #endif 25 | 26 | #ifndef STDEXT_THREAD_MUTEX_H 27 | #include "thread/Mutex.h" 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // class CriticalSectionST, CriticalSectionMT 34 | 35 | typedef FakeMutex CriticalSectionST; 36 | typedef Mutex CriticalSectionMT; 37 | 38 | // ------------------------------------------------------------------------- 39 | // class MultiThreadModel 40 | 41 | class MT 42 | { 43 | public: 44 | typedef RefCountMT RefCount; 45 | typedef CriticalSectionMT CriticalSection; 46 | 47 | public: 48 | typedef CriticalSection CS; 49 | typedef CS::scoped_lock CSLock; 50 | }; 51 | 52 | typedef MT MultiThreadModel; 53 | 54 | // ------------------------------------------------------------------------- 55 | // class SingleThreadModel 56 | 57 | class ST 58 | { 59 | public: 60 | typedef RefCountST RefCount; 61 | typedef CriticalSectionST CriticalSection; 62 | 63 | public: 64 | typedef CriticalSection CS; 65 | typedef CS::scoped_lock CSLock; 66 | }; 67 | 68 | typedef ST SingleThreadModel; 69 | 70 | // ------------------------------------------------------------------------- 71 | // class DefaultThreadModel 72 | 73 | #if defined(_MT) 74 | typedef MultiThreadModel DefaultThreadModel; 75 | #else 76 | typedef SingleThreadModel DefaultThreadModel; 77 | #endif 78 | 79 | // ------------------------------------------------------------------------- 80 | // $Log: $ 81 | 82 | NS_STDEXT_END 83 | 84 | #endif /* STDEXT_THREADMODEL_H */ 85 | -------------------------------------------------------------------------------- /include/stdext/archive/Mem.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/archive/Mem.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-11-29 21:07:06 16 | // 17 | // $Id: Mem.h,v 1.3 2007/01/10 09:36:12 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_ARCHIVE_MEM_H 20 | #define STDEXT_ARCHIVE_MEM_H 21 | 22 | #ifndef STDEXT_ARCHIVE_MEMARCHIVE_H 23 | #include "MemArchive.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // class MemReader 30 | 31 | typedef MemReadArchive PointerReadArchive; 32 | typedef PointerReadArchive MemReader; 33 | 34 | // ------------------------------------------------------------------------- 35 | // class VectorReader/VectorWriter 36 | 37 | typedef std::vector CharVector; 38 | 39 | typedef MemWriteArchive VectorWriteArchive; 40 | typedef VectorWriteArchive VectorWriter; 41 | 42 | typedef MemReadArchive VectorReadArchive; 43 | typedef VectorReadArchive VectorReader; 44 | 45 | // ------------------------------------------------------------------------- 46 | // class StringBuilderReader/StringBuilderWriter 47 | 48 | typedef VectorWriter StringBuilderWriter; 49 | typedef VectorReader StringBuilderReader; 50 | 51 | // ------------------------------------------------------------------------- 52 | // class StlStringReader/StlStringWriter 53 | 54 | typedef MemWriteArchive StlStringWriteArchive; 55 | typedef StlStringWriteArchive StlStringWriter; 56 | 57 | typedef MemReadArchive StlStringReadArchive; 58 | typedef StlStringReadArchive StlStringReader; 59 | 60 | // ------------------------------------------------------------------------- 61 | // class DequeReader/DequeWriter, TextPoolReader/TextPoolWriter 62 | 63 | #ifdef STDEXT_DEQUE_H 64 | 65 | typedef std::Deque CharDeque; 66 | 67 | typedef MemWriteArchive DequeWriteArchive; 68 | typedef DequeWriteArchive DequeWriter; 69 | 70 | typedef MemReadArchive DequeReadArchive; 71 | typedef DequeReadArchive DequeReader; 72 | 73 | typedef DequeWriter TextPoolWriter; 74 | typedef DequeReader TextPoolReader; 75 | 76 | #endif 77 | 78 | NS_STDEXT_END 79 | 80 | // ------------------------------------------------------------------------- 81 | // $Log: Mem.h,v $ 82 | 83 | #endif /* STDEXT_ARCHIVE_MEM_H */ 84 | -------------------------------------------------------------------------------- /include/stdext/archive/ReadArchive.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/archive/ReadArchive.h -------------------------------------------------------------------------------- /include/stdext/archive/Stream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/archive/Stream.h -------------------------------------------------------------------------------- /include/stdext/archive/WriteArchive.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/archive/WriteArchive.h -------------------------------------------------------------------------------- /include/stdext/archive/posix/Config.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/archive/posix/Config.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-11-29 21:07:06 16 | // 17 | // $Id: Config.h,v 1.3 2007/01/10 09:36:12 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_ARCHIVE_POSIX_CONFIG_H 20 | #define STDEXT_ARCHIVE_POSIX_CONFIG_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../../Platform.h" 24 | #endif 25 | 26 | #if defined(X_OS_WINDOWS) 27 | #pragma warning(disable:4996) 28 | // ------------------------------------------------------------------------- 29 | // Windows 30 | 31 | #ifndef _INC_IO 32 | #include 33 | #endif 34 | 35 | #ifndef _INC_FCNTL 36 | #include 37 | #endif 38 | 39 | #ifndef _INC_STAT 40 | #include 41 | #endif 42 | 43 | typedef long __off_t; 44 | 45 | inline int fsync(int fd) 46 | { 47 | return _commit(fd); 48 | } 49 | 50 | #elif defined(X_OS_LINUX) 51 | // ------------------------------------------------------------------------- 52 | // Linux 53 | 54 | #ifndef _SYS_STAT_H 55 | #include 56 | #endif 57 | 58 | #ifndef _FCNTL_H 59 | #include 60 | #endif 61 | 62 | #ifndef _UNISTD_H 63 | #include 64 | #endif 65 | 66 | #ifndef O_BINARY 67 | #define O_BINARY 0 68 | #endif 69 | 70 | inline __off_t _filelength(int fd) 71 | { 72 | struct stat s; 73 | if (fstat(fd, &s) < 0) 74 | return 0; 75 | return s.st_size; 76 | } 77 | 78 | inline __off_t tell(int fd) 79 | { 80 | return lseek(fd, 0, SEEK_CUR); 81 | } 82 | 83 | inline int _commit(int fd) 84 | { 85 | return fsync(fd); 86 | } 87 | // ------------------------------------------------------------------------- 88 | // $Log: Config.h,v $ 89 | 90 | #endif 91 | 92 | #endif /* STDEXT_ARCHIVE_POSIX_CONFIG_H */ 93 | -------------------------------------------------------------------------------- /include/stdext/boost/Memory.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/boost/Memory.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 15:43:17 16 | // 17 | // $Id: Memory.h 1427 2010-04-05 10:16:37Z xushiweizh@gmail.com $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_BOOST_MEMORY_H 20 | #define STDEXT_BOOST_MEMORY_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #define NS_BOOST_MEMORY_BEGIN namespace NS_STDEXT { 25 | #define NS_BOOST_MEMORY_END } 26 | #define NS_BOOST_MEMORY NS_STDEXT 27 | #define NS_BOOST_MEMORY_POLICY_BEGIN 28 | #define NS_BOOST_MEMORY_POLICY_END 29 | #define NS_BOOST_MEMORY_POLICY NS_STDEXT 30 | 31 | #ifndef NS_BOOST_DETAIL_BEGIN 32 | #define NS_BOOST_DETAIL_BEGIN namespace NS_STDEXT { 33 | #define NS_BOOST_DETAIL_END } 34 | #define NS_BOOST_DETAIL NS_STDEXT 35 | #endif 36 | 37 | #ifndef BOOST_MEMORY_HPP 38 | #include "../../../../memory/boost/memory.hpp" 39 | #endif 40 | 41 | // ------------------------------------------------------------------------- 42 | 43 | #endif /* STDEXT_BOOST_MEMORY_H */ 44 | -------------------------------------------------------------------------------- /include/stdext/boost/Tuple.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/boost/Tuple.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 15:43:17 16 | // 17 | // $Id: Tuple.h 602 2008-05-29 05:21:08Z xushiweizh@gmail.com $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_BOOST_TUPLE_H 20 | #define STDEXT_BOOST_TUPLE_H 21 | 22 | #ifndef BOOST_TUPLE_HPP 23 | #include 24 | #endif 25 | 26 | #ifndef STDEXT_TUPLE_H 27 | #include "../Tuple.h" 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // TupleItemTraits 34 | 35 | template < 36 | int Index, 37 | class T0, class T1, class T2, 38 | class T3, class T4, class T5, 39 | class T6, class T7, class T8, 40 | class T9> 41 | struct TupleItemTraits > 42 | { 43 | typedef boost::tuples::tuple TupleT; 44 | typedef typename boost::tuples::element::type value_type; 45 | 46 | typedef value_type& reference; 47 | typedef const value_type& const_reference; 48 | 49 | static reference winx_call get(TupleT& o) { 50 | return boost::tuples::template get(o); 51 | } 52 | 53 | static const_reference winx_call get(const TupleT& o) { 54 | return boost::tuples::template get(o); 55 | } 56 | }; 57 | 58 | // ------------------------------------------------------------------------- 59 | // TupleTraits 60 | 61 | template 62 | struct TupleDestructorTraits { 63 | enum { HasDestructor = 64 | DestructorTraits::HasDestructor | 65 | TupleDestructorTraits::HasDestructor }; 66 | }; 67 | 68 | template<> 69 | struct TupleDestructorTraits > { 70 | enum { HasDestructor = 0 }; 71 | }; 72 | 73 | template<> 74 | struct TupleDestructorTraits { 75 | enum { HasDestructor = 0 }; 76 | }; 77 | 78 | template < 79 | class T0, class T1, class T2, 80 | class T3, class T4, class T5, 81 | class T6, class T7, class T8, 82 | class T9> 83 | struct TupleTraits > 84 | { 85 | typedef boost::tuples::tuple TupleT; 86 | enum { Fields = boost::tuples::length::value }; 87 | enum { HasDestructor = TupleDestructorTraits::HasDestructor }; 88 | }; 89 | 90 | // ------------------------------------------------------------------------- 91 | // $Log: Tuple.h,v $ 92 | 93 | NS_STDEXT_END 94 | 95 | #endif /* STDEXT_BOOST_TUPLE_H */ 96 | 97 | -------------------------------------------------------------------------------- /include/stdext/codepage/CP1252.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/codepage/CP1252.h -------------------------------------------------------------------------------- /include/stdext/detail/GlobalVar.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/detail/GlobalVar.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: GlobalVar.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_DETAIL_GLOBALVAR_H 20 | #define STDEXT_DETAIL_GLOBALVAR_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // struct GlobalVar 30 | 31 | namespace detail 32 | { 33 | template 34 | struct GlobalVar 35 | { 36 | static Type g_var; 37 | }; 38 | 39 | template 40 | Type GlobalVar::g_var; 41 | } 42 | 43 | // ------------------------------------------------------------------------- 44 | 45 | #define WINX_DETAIL_GIDX_TLS_MUTEX_ int // see 46 | 47 | // ------------------------------------------------------------------------- 48 | 49 | NS_STDEXT_END 50 | 51 | #endif /* STDEXT_DETAIL_GLOBALVAR_H */ 52 | -------------------------------------------------------------------------------- /include/stdext/digest/MD4.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/digest/MD4.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-11-29 19:27:08 16 | // 17 | // $Id: MD4.h,v 1.4 2006/12/14 09:15:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_DIGEST_MD4_H 20 | #define STDEXT_DIGEST_MD4_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | 30 | namespace detail { 31 | 32 | #include "md4/md4.h" 33 | 34 | } // namespace detail 35 | 36 | // ------------------------------------------------------------------------- 37 | // class MD4Checksum 38 | 39 | class MD4Checksum 40 | { 41 | private: 42 | detail::MD4_CTX context; 43 | 44 | public: 45 | MD4Checksum() { 46 | detail::MD4Init(&context); 47 | } 48 | 49 | void winx_call Update(const BYTE* buf, size_t bytes) { 50 | detail::MD4Update(&context, buf, (UINT)bytes); 51 | } 52 | 53 | void winx_call Final(BYTE checksum[16]) { 54 | detail::MD4Final(checksum, &context); 55 | } 56 | }; 57 | 58 | // ------------------------------------------------------------------------- 59 | // function md4 60 | 61 | inline void winx_call md4(const void* buf, size_t bytes, BYTE checksum[16]) 62 | { 63 | using namespace detail; 64 | 65 | MD4_CTX context; 66 | MD4Init(&context); 67 | MD4Update(&context, (const BYTE*)buf, (UINT)bytes); 68 | MD4Final(checksum, &context); 69 | } 70 | 71 | // ------------------------------------------------------------------------- 72 | 73 | NS_STDEXT_END 74 | 75 | #endif /* STDEXT_DIGEST_MD4_H */ 76 | -------------------------------------------------------------------------------- /include/stdext/digest/MD5.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/digest/MD5.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-11-29 19:27:08 16 | // 17 | // $Id: MD5.h,v 1.4 2006/12/14 09:15:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_DIGEST_MD5_H 20 | #define STDEXT_DIGEST_MD5_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | 30 | namespace detail { 31 | 32 | #include "md5/MD5Checksum.h" 33 | #include "md5/MD5ChecksumDefines.h" 34 | #include "md5/MD5ChecksumImpl.h" 35 | 36 | } // namespace detail 37 | 38 | typedef detail::CMD5Checksum MD5Checksum; 39 | 40 | // ------------------------------------------------------------------------- 41 | // function md5 42 | 43 | inline void winx_call md5(const void* buf, size_t bytes, BYTE checksum[16]) 44 | { 45 | MD5Checksum chksum; 46 | chksum.Update( (const BYTE*)buf, (UINT)bytes ); 47 | chksum.Final( checksum ); 48 | } 49 | 50 | // ------------------------------------------------------------------------- 51 | 52 | NS_STDEXT_END 53 | 54 | #endif /* STDEXT_DIGEST_MD5_H */ 55 | -------------------------------------------------------------------------------- /include/stdext/digest/SHA1.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/digest/SHA1.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-11-29 19:27:08 16 | // 17 | // $Id: SHA1.h,v 1.4 2006/12/14 09:15:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_DIGEST_SHA1_H 20 | #define STDEXT_DIGEST_SHA1_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | 30 | namespace detail { 31 | 32 | #include "sha1/sha1.h" 33 | #include "sha1/sha1.inl" 34 | 35 | } // namespace detail 36 | 37 | class SHA1Checksum 38 | { 39 | private: 40 | detail::SHA1 m_impl; 41 | 42 | public: 43 | void winx_call Update(const BYTE* buf, size_t bytes) { 44 | m_impl.Input(buf, (UINT)bytes); 45 | } 46 | 47 | void winx_call Reset() 48 | { 49 | m_impl.Reset(); 50 | } 51 | 52 | #if defined(WINX_BYTESWAP) 53 | void winx_call Final(BYTE checksum[20]) 54 | { 55 | m_impl.Result( (detail::UINT4*)checksum ); 56 | } 57 | #else 58 | void winx_call Final(BYTE* checksum) 59 | { 60 | detail::UINT4 key[5]; 61 | m_impl.Result( key ); 62 | for (size_t i = 0; i < 5; ++i) 63 | { 64 | *checksum++ = (BYTE)(key[i] >> 24); 65 | *checksum++ = (BYTE)(key[i] >> 16); 66 | *checksum++ = (BYTE)(key[i] >> 8); 67 | *checksum++ = (BYTE)key[i]; 68 | } 69 | } 70 | #endif 71 | }; 72 | 73 | // ------------------------------------------------------------------------- 74 | // function sha1 75 | 76 | inline void winx_call sha1(const void* buf, size_t bytes, BYTE checksum[20]) 77 | { 78 | SHA1Checksum chksum; 79 | chksum.Update( (const BYTE*)buf, (UINT)bytes ); 80 | chksum.Final( checksum ); 81 | } 82 | 83 | // ------------------------------------------------------------------------- 84 | 85 | NS_STDEXT_END 86 | 87 | #endif /* STDEXT_DIGEST_SHA1_H */ 88 | -------------------------------------------------------------------------------- /include/stdext/digest/sha1/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 1998, 2009 2 | Paul E. Jones 3 | 4 | Freeware Public License (FPL) 5 | 6 | This software is licensed as "freeware." Permission to distribute 7 | this software in source and binary forms, including incorporation 8 | into other products, is hereby granted without a fee. THIS SOFTWARE 9 | IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, 10 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 11 | AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD 12 | LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER 13 | DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA 14 | OR DATA BEING RENDERED INACCURATE. 15 | -------------------------------------------------------------------------------- /include/stdext/digest/sha1/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sha1.h 3 | * 4 | * Copyright (C) 1998, 2009 5 | * Paul E. Jones 6 | * All Rights Reserved. 7 | * 8 | ***************************************************************************** 9 | * $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $ 10 | ***************************************************************************** 11 | * 12 | * Description: 13 | * This class implements the Secure Hashing Standard as defined 14 | * in FIPS PUB 180-1 published April 17, 1995. 15 | * 16 | * Many of the variable names in this class, especially the single 17 | * character names, were used because those were the names used 18 | * in the publication. 19 | * 20 | * Please read the file sha1.cpp for more information. 21 | * 22 | */ 23 | 24 | #ifndef _SHA1_H_ 25 | #define _SHA1_H_ 26 | 27 | /* UINT2 defines a two byte word */ 28 | typedef unsigned short int UINT2; 29 | 30 | /* UINT4 defines a four byte word */ 31 | typedef unsigned long int UINT4; 32 | 33 | class SHA1 34 | { 35 | 36 | public: 37 | 38 | SHA1(); 39 | ~SHA1(); 40 | 41 | /* 42 | * Re-initialize the class 43 | */ 44 | void Reset(); 45 | 46 | /* 47 | * Returns the message digest 48 | */ 49 | bool Result(UINT4 *message_digest_array); 50 | 51 | /* 52 | * Provide input to SHA1 53 | */ 54 | void Input( const unsigned char *message_array, 55 | unsigned length); 56 | void Input( const char *message_array, 57 | unsigned length); 58 | void Input(unsigned char message_element); 59 | void Input(char message_element); 60 | SHA1& operator<<(const char *message_array); 61 | SHA1& operator<<(const unsigned char *message_array); 62 | SHA1& operator<<(const char message_element); 63 | SHA1& operator<<(const unsigned char message_element); 64 | 65 | private: 66 | 67 | /* 68 | * Process the next 512 bits of the message 69 | */ 70 | void ProcessMessageBlock(); 71 | 72 | /* 73 | * Pads the current message block to 512 bits 74 | */ 75 | void PadMessage(); 76 | 77 | /* 78 | * Performs a circular left shift operation 79 | */ 80 | inline UINT4 CircularShift(int bits, UINT4 word); 81 | 82 | UINT4 H[5]; // Message digest buffers 83 | 84 | UINT4 Length_Low; // Message length in bits 85 | UINT4 Length_High; // Message length in bits 86 | 87 | unsigned char Message_Block[64]; // 512-bit message blocks 88 | int Message_Block_Index; // Index into message block array 89 | 90 | bool Computed; // Is the digest computed? 91 | bool Corrupted; // Is the message digest corruped? 92 | 93 | }; 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /include/stdext/filebuf/AutoBuffer.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/filebuf/AutoBuffer.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-9-25 15:33:27 16 | // 17 | // $Id: AutoBuffer.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_FILEBUF_AUTOBUFFER_H 20 | #define STDEXT_FILEBUF_AUTOBUFFER_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // class AutoBufferT 30 | 31 | template 32 | class AutoBufferT 33 | { 34 | protected: 35 | char* m_data; 36 | size_t m_bytes; 37 | 38 | public: 39 | typedef char* iterator; 40 | typedef const char* const_iterator; 41 | 42 | public: 43 | AutoBufferT() : m_data(NULL), m_bytes(0) {} 44 | explicit AutoBufferT(size_t bytes) : m_data(NULL) { 45 | allocate(bytes); 46 | } 47 | ~AutoBufferT() { 48 | if (m_data) 49 | AllocT::deallocate(m_data); 50 | } 51 | 52 | char* winx_call allocate(size_t bytes) { 53 | WINX_ASSERT(m_data == NULL); 54 | m_bytes = bytes; 55 | m_data = (char*)AllocT::allocate(bytes); 56 | return m_data; 57 | } 58 | 59 | void winx_call clear() { 60 | if (m_data) { 61 | AllocT::deallocate(m_data, m_bytes); 62 | m_data = NULL; 63 | } 64 | } 65 | 66 | char* winx_call data() { 67 | return m_data; 68 | } 69 | const char* winx_call data() const { 70 | return m_data; 71 | } 72 | 73 | char* winx_call begin() { 74 | return m_data; 75 | } 76 | const char* winx_call begin() const { 77 | return m_data; 78 | } 79 | 80 | char* winx_call end() { 81 | return m_data + m_bytes; 82 | } 83 | const char* winx_call end() const { 84 | return m_data + m_bytes; 85 | } 86 | 87 | int winx_call good() const { 88 | return m_data != NULL; 89 | } 90 | 91 | const size_t winx_call size() const { 92 | return m_bytes; 93 | } 94 | }; 95 | 96 | // ------------------------------------------------------------------------- 97 | 98 | NS_STDEXT_END 99 | 100 | #endif /* STDEXT_FILEBUF_AUTOBUFFER_H */ 101 | 102 | -------------------------------------------------------------------------------- /include/stdext/filebuf/MapFileBuf.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/filebuf/MapFileBuf.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2007-1-31 10:11:31 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_FILEBUF_MAPFILEBUF_H 20 | #define STDEXT_FILEBUF_MAPFILEBUF_H 21 | 22 | #ifndef STDEXT_MMAP_MAPFILE_H 23 | #include "../mmap/MapFile.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // class MapFileBuf 30 | 31 | class MapFileBuf 32 | { 33 | private: 34 | const char* m_data; 35 | size_t m_fileSize; 36 | MapFileRO m_mapfile; 37 | 38 | public: 39 | MapFileBuf() : m_data(NULL) {} 40 | 41 | MapFileBuf(LPCSTR file) : m_data(NULL) { 42 | read(file); 43 | } 44 | 45 | MapFileBuf(LPCWSTR file) : m_data(NULL) { 46 | read(file); 47 | } 48 | 49 | ~MapFileBuf() { 50 | if (m_data) { 51 | MapFileRO::unmap((void*)m_data, m_fileSize); 52 | m_mapfile.close(); 53 | } 54 | } 55 | 56 | public: 57 | HRESULT winx_call read(LPCSTR file) 58 | { 59 | if (good()) 60 | return E_ACCESSDENIED; 61 | 62 | MapFileRO::pos_type fileSize; 63 | HRESULT hr = m_mapfile.open(file, &fileSize); 64 | if (hr != S_OK) 65 | return hr; 66 | 67 | if (fileSize > 0xFFFFFFFF) 68 | return E_OUTOFMEMORY; 69 | 70 | m_fileSize = (DWORD)fileSize; 71 | m_data = (const char*)m_mapfile.map(0, m_fileSize); 72 | if (m_data) 73 | return S_OK; 74 | 75 | m_mapfile.close(); 76 | return E_FAIL; 77 | } 78 | 79 | HRESULT winx_call read(LPCWSTR file) 80 | { 81 | WINX_USES_CONVERSION; 82 | return read(WINX_W2CA(file)); 83 | } 84 | 85 | public: 86 | void winx_call clear() { 87 | if (m_data) { 88 | MapFileRO::unmap((void*)m_data, m_fileSize); 89 | m_data = NULL; 90 | m_mapfile.close(); 91 | } 92 | } 93 | 94 | const char* winx_call data() const { 95 | return m_data; 96 | } 97 | 98 | const char* winx_call begin() const { 99 | return m_data; 100 | } 101 | 102 | const char* winx_call end() const { 103 | return m_data + m_fileSize; 104 | } 105 | 106 | bool winx_call good() const { 107 | return m_data != NULL; 108 | } 109 | 110 | const size_t winx_call size() const { 111 | return m_fileSize; 112 | } 113 | }; 114 | 115 | // ------------------------------------------------------------------------- 116 | // $Log: $ 117 | 118 | NS_STDEXT_END 119 | 120 | #endif /* STDEXT_FILEBUF_MAPFILEBUF_H */ 121 | -------------------------------------------------------------------------------- /include/stdext/filebuf/WinFile.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/filebuf/WinFile.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-9-25 15:33:27 16 | // 17 | // $Id: WinFile.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_FILEBUF_WINFILE_H 20 | #define STDEXT_FILEBUF_WINFILE_H 21 | 22 | #ifndef STDEXT_MEMORY_H 23 | #include "../Memory.h" 24 | #endif 25 | 26 | #ifndef STDEXT_FILEBUF_AUTOBUFFER_H 27 | #include "AutoBuffer.h" 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // class WinFileBuf 34 | 35 | template 36 | class WinFileBufT : public AutoBufferT 37 | { 38 | private: 39 | typedef AutoBufferT Base; 40 | 41 | HRESULT winx_call _read(HANDLE hFile) 42 | { 43 | WINX_ASSERT(!Base::good()); 44 | 45 | DWORD dwFileSizeHigh = 0; 46 | DWORD dwFileSize = ::GetFileSize(hFile, &dwFileSizeHigh); 47 | if (dwFileSizeHigh > 0) 48 | return E_OUTOFMEMORY; 49 | 50 | ::ReadFile(hFile, Base::allocate(dwFileSize), dwFileSize, &dwFileSizeHigh, NULL); 51 | return (dwFileSizeHigh == dwFileSize ? S_OK : STG_E_READFAULT); 52 | } 53 | 54 | public: 55 | WinFileBufT() {} 56 | 57 | template 58 | explicit WinFileBufT(const InputFileT& file) { 59 | read(file); 60 | } 61 | 62 | HRESULT winx_call read(LPCSTR file) 63 | { 64 | HANDLE hFile = ::CreateFileA( 65 | file, 66 | GENERIC_READ, FILE_SHARE_READ, NULL, 67 | OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); 68 | if (hFile == INVALID_HANDLE_VALUE) 69 | return HRESULT_FROM_WIN32(::GetLastError()); 70 | 71 | HRESULT hr = _read(hFile); 72 | ::CloseHandle(hFile); 73 | return hr; 74 | } 75 | 76 | HRESULT winx_call read(LPCWSTR file) 77 | { 78 | HANDLE hFile = ::CreateFileW( 79 | file, 80 | GENERIC_READ, FILE_SHARE_READ, NULL, 81 | OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); 82 | if (hFile == INVALID_HANDLE_VALUE) 83 | return HRESULT_FROM_WIN32(::GetLastError()); 84 | 85 | HRESULT hr = _read(hFile); 86 | ::CloseHandle(hFile); 87 | return hr; 88 | } 89 | }; 90 | 91 | typedef WinFileBufT WinFileBuf; 92 | 93 | // ------------------------------------------------------------------------- 94 | 95 | NS_STDEXT_END 96 | 97 | #endif /* STDEXT_FILEBUF_WINFILE_H */ 98 | 99 | -------------------------------------------------------------------------------- /include/stdext/int/Traits.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/int/Traits.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:08:57 16 | // 17 | // $Id: Traits.h 2004-7-9 09:38:10 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_INT_TRAITS_H 20 | #define STDEXT_INT_TRAITS_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // Int TypeTraits 30 | 31 | template 32 | struct IntTypeTraits 33 | { 34 | }; 35 | 36 | #define WINX_INT_TYPETRAITS_(IntT, isSigned, SignedT, UnsignedT) \ 37 | template <> \ 38 | struct IntTypeTraits \ 39 | { \ 40 | enum { fsigned = isSigned }; \ 41 | typedef SignedT signed_type; \ 42 | typedef UnsignedT unsigned_type; \ 43 | } 44 | 45 | #define WINX_INT_TYPEPAIR_(IntT, UIntT) \ 46 | WINX_INT_TYPETRAITS_(IntT, TRUE, IntT, UIntT); \ 47 | WINX_INT_TYPETRAITS_(UIntT, FALSE, IntT, UIntT) 48 | 49 | // ------------------------------------------------------------------------- 50 | 51 | WINX_INT_TYPEPAIR_(char, unsigned char); 52 | WINX_INT_TYPEPAIR_(short, unsigned short); 53 | WINX_INT_TYPEPAIR_(int, unsigned int); 54 | WINX_INT_TYPEPAIR_(long, unsigned long); 55 | WINX_INT_TYPEPAIR_(INT64, UINT64); 56 | 57 | // ------------------------------------------------------------------------- 58 | 59 | NS_STDEXT_END 60 | 61 | #endif /* STDEXT_INT_TRAITS_H */ 62 | -------------------------------------------------------------------------------- /include/stdext/kmp/Finder.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/kmp/Finder.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: Finder.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_KMP_FINDER_H 20 | #define STDEXT_KMP_FINDER_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef STDEXT_SEARCH_KMP_H 25 | #include "../search/KMP.h" 26 | #endif 27 | 28 | // ------------------------------------------------------------------------- 29 | // $Log: Finder.h,v $ 30 | 31 | #endif /* STDEXT_KMP_FINDER_H */ 32 | -------------------------------------------------------------------------------- /include/stdext/kmp/RefFinder.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/kmp/RefFinder.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2005-4-29 16:09:26 16 | // 17 | // $Id: RefFinder.h,v 1.1 2006/12/02 08:00:45 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_KMP_REFFINDER_H 20 | #define STDEXT_KMP_REFFINDER_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef STDEXT_SEARCH_REFFINDER_H 25 | #include "../search/RefFinder.h" 26 | #endif 27 | 28 | // ------------------------------------------------------------------------- 29 | // $Log: RefFinder.h,v $ 30 | 31 | #endif /* STDEXT_KMP_REFFINDER_H */ 32 | -------------------------------------------------------------------------------- /include/stdext/kmp/TestFinder.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/kmp/TestFinder.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-12-2 15:53:51 16 | // 17 | // $Id: TestFinder.h,v 1.2 2006/12/03 07:52:27 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_KMP_TESTFINDER_H 20 | #define STDEXT_KMP_TESTFINDER_H 21 | 22 | #ifndef STDEXT_KMP_REFFINDER_H 23 | #include "RefFinder.h" 24 | #endif 25 | 26 | #ifndef STD_DEQUE_H 27 | #include "../../std/deque.h" 28 | #endif 29 | 30 | #ifndef _FSTREAM_ 31 | #include 32 | #endif 33 | 34 | // ------------------------------------------------------------------------- 35 | 36 | #if defined(STD_UNITTEST) 37 | 38 | template 39 | class TestFinder : public TestCase 40 | { 41 | public: 42 | WINX_TEST_SUITE(TestFinder); 43 | WINX_TEST(testSearchInCStr); 44 | WINX_TEST(testSearchInArchive); 45 | WINX_TEST(testSearchInDeque); 46 | WINX_TEST(testSearchInFStream); 47 | WINX_TEST_SUITE_END(); 48 | 49 | public: 50 | void testSearchInArchive(LogT& log) 51 | { 52 | NS_STDEXT::BlockPool recycle; 53 | NS_STDEXT::ScopedAlloc alloc(recycle); 54 | 55 | std::string line; 56 | NS_STDEXT::StdioReader ar(__FILE__); 57 | 58 | NS_STDEXT::kmp::Finder finder("NS_STDEXT::kmp::Finder"); 59 | HRESULT hr = finder.next(ar); 60 | AssertExp(hr == S_OK); 61 | 62 | ar.getline(line); 63 | log.trace("\nline =%s\n", line.c_str()); 64 | } 65 | 66 | void testSearchInFStream(LogT& log) 67 | { 68 | std::string line; 69 | std::ifstream is(__FILE__); 70 | 71 | NS_STDEXT::kmp::Finder finder("std::ifstream"); 72 | HRESULT hr = finder.istreamNext(is); 73 | AssertExp(hr == S_OK); 74 | 75 | std::getline(is, line); 76 | log.trace("\nline =%s\n", line.c_str()); 77 | } 78 | 79 | void testSearchInCStr(LogT& log) 80 | { 81 | const char* p; 82 | const char dest[] = "1234ababcde"; 83 | 84 | NS_STDEXT::kmp::Finder finder("abc"); 85 | HRESULT hr = finder.cstrNext(dest, &p); 86 | AssertExp(hr == S_OK); 87 | AssertExp(strcmp(p, "de") == 0); 88 | } 89 | 90 | void testSearchInDeque(LogT& log) 91 | { 92 | typedef std::deque Container; 93 | 94 | const char destBuf[] = "1234ababcde"; 95 | Container::iterator itFind; 96 | Container dest(sizeof(destBuf)); 97 | std::copy(destBuf, destBuf+sizeof(destBuf), dest.begin()); 98 | 99 | NS_STDEXT::kmp::Finder finder("abc"); 100 | HRESULT hr = finder.iteratorNext(dest.begin(), dest.end(), &itFind); 101 | AssertExp(hr == S_OK); 102 | AssertExp(dest.end() - itFind == 3); 103 | } 104 | }; 105 | 106 | #endif // defined(STD_UNITTEST) 107 | 108 | // ------------------------------------------------------------------------- 109 | // $Log: TestFinder.h,v $ 110 | 111 | #endif /* STDEXT_KMP_TESTFINDER_H */ 112 | -------------------------------------------------------------------------------- /include/stdext/memory/RecycleBuffer.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/memory/RecycleBuffer.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 13:46:39 16 | // 17 | // $Id: RecycleBuffer.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_MEMORY_RECYCLEBUFFER_H 20 | #define STDEXT_MEMORY_RECYCLEBUFFER_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ------------------------------------------------------------------------- 29 | // class RecycleBuffer 30 | 31 | template 32 | class RecycleBuffer 33 | { 34 | private: 35 | _Ty* m_buf; 36 | size_t m_size; 37 | 38 | public: 39 | typedef _Ty* pointer; 40 | 41 | public: 42 | RecycleBuffer() : m_size(0), m_buf(NULL) {} 43 | explicit RecycleBuffer(size_t nInitial) 44 | : m_size(nInitial) 45 | { 46 | m_buf = (_Ty*)malloc(sizeof(_Ty)*m_size); 47 | } 48 | ~RecycleBuffer() 49 | { 50 | if (m_buf) 51 | free(m_buf); 52 | } 53 | 54 | pointer winx_call data() const { 55 | return m_buf; 56 | } 57 | 58 | pointer winx_call begin() const { 59 | return m_buf; 60 | } 61 | 62 | pointer winx_call reserve(size_t nSize) 63 | { 64 | if (nSize > m_size) { 65 | free(m_buf); 66 | m_size = ROUND(nSize, _RoundSize); 67 | m_buf = (_Ty*)malloc(sizeof(_Ty)*m_size); 68 | } 69 | return m_buf; 70 | } 71 | }; 72 | 73 | // ------------------------------------------------------------------------- 74 | // $Log: RecycleBuffer.h,v $ 75 | 76 | NS_STDEXT_END 77 | 78 | #endif /* STDEXT_MEMORY_RECYCLEBUFFER_H */ 79 | -------------------------------------------------------------------------------- /include/stdext/memory/TlsPools.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/memory/TlsPools.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 13:46:39 16 | // 17 | // $Id: TlsPools.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_MEMORY_TLSPOOLS_H 20 | #define STDEXT_MEMORY_TLSPOOLS_H 21 | 22 | #ifndef STDEXT_BOOST_MEMORY_H 23 | #include "../boost/Memory.h" 24 | #endif 25 | 26 | #ifndef STDEXT_THREAD_TLS_H 27 | #include "../thread/TLS.h" 28 | #endif 29 | 30 | NS_BOOST_MEMORY_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // class tls_pools 34 | 35 | template 36 | class tls_pools_alloc 37 | { 38 | private: 39 | static NS_STDEXT::TlsKey g_tls; 40 | 41 | public: 42 | typedef pools_alloc pools_type; 43 | 44 | static void BOOST_MEMORY_CALL put(pools_type& r) 45 | { 46 | static int g_result = g_tls.create(); 47 | (void)g_result; 48 | g_tls.put(&r); 49 | } 50 | 51 | static pools_type& BOOST_MEMORY_CALL get() 52 | { 53 | pools_type* po = (pools_type*)g_tls.get(); 54 | BOOST_MEMORY_ASSERT(po!= NULL); 55 | return *po; 56 | } 57 | 58 | static void* BOOST_MEMORY_CALL allocate(size_t cb) 59 | { 60 | pools_type* po = (pools_type*)g_tls.get(); 61 | BOOST_MEMORY_ASSERT(po != NULL); 62 | return po->allocate(cb); 63 | } 64 | 65 | static void BOOST_MEMORY_CALL deallocate(void* p, size_t cb) 66 | { 67 | pools_type* po = (pools_type*)g_tls.get(); 68 | BOOST_MEMORY_ASSERT(po != NULL); 69 | po->deallocate(p, cb); 70 | } 71 | 72 | static size_t BOOST_MEMORY_CALL alloc_size(void* p, size_t cb) 73 | { 74 | pools_type* po = (pools_type*)g_tls.get(); 75 | BOOST_MEMORY_ASSERT(po != NULL); 76 | return po->alloc_size(p, cb); 77 | } 78 | }; 79 | 80 | template 81 | NS_STDEXT::TlsKey tls_pools_alloc::g_tls; 82 | 83 | typedef tls_pools_alloc tls_pools; 84 | 85 | // ------------------------------------------------------------------------- 86 | 87 | NS_BOOST_MEMORY_END 88 | 89 | #endif /* STDEXT_MEMORY_TLSPOOLS_H */ 90 | -------------------------------------------------------------------------------- /include/stdext/mmap/MapFile.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/mmap/MapFile.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-13 9:41:58 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_MMAP_MAPFILE_H 20 | #define STDEXT_MMAP_MAPFILE_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // class MapFile 28 | 29 | #if defined(X_OS_WINDOWS) 30 | 31 | #ifndef STDEXT_MAPFILE_WINFILEMAPPING_H 32 | #include "../mapfile/WinFileMapping.h" 33 | #endif 34 | 35 | #else 36 | 37 | #ifndef STDEXT_MAPFILE_MMAP_H 38 | #include "../mapfile/MMap.h" 39 | #endif 40 | 41 | #endif 42 | 43 | NS_STDEXT_BEGIN 44 | 45 | typedef MapFile MapFileRW; 46 | typedef MapFile MapFileRO; 47 | 48 | NS_STDEXT_END 49 | 50 | // ------------------------------------------------------------------------- 51 | // $Log: $ 52 | 53 | #endif /* STDEXT_MMAP_MAPFILE_H */ 54 | -------------------------------------------------------------------------------- /include/stdext/patch/string.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/patch/string.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-12-22 17:37:57 16 | // 17 | // $Id: string.h,v 1.1 2006/12/22 10:19:55 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_PATCH_STRING_H 20 | #define STDEXT_PATCH_STRING_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #if defined(X_STL_VC6) 25 | 26 | #if defined(_MSC_VER) && (_MSC_VER == 1200) 27 | #include "vc6/string.h" 28 | #endif 29 | 30 | #endif 31 | 32 | // ------------------------------------------------------------------------- 33 | // $Log: string.h,v $ 34 | // Revision 1.1 2006/12/22 10:19:55 xushiwei 35 | // STL-Patch: std::basic_string::_Split function bugfix (vc6) 36 | // 37 | 38 | #endif /* STDEXT_PATCH_STRING_H */ 39 | -------------------------------------------------------------------------------- /include/stdext/posix/dirent.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/dirent.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_DIRENT_H 20 | #define STDEXT_POSIX_DIRENT_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_OS_WINDOWS) 29 | #include "dirent/windows.h" 30 | #else 31 | #ifndef _DIRENT_H 32 | #include 33 | #endif 34 | #endif 35 | 36 | // ------------------------------------------------------------------------- 37 | 38 | #endif /* STDEXT_POSIX_DIRENT_H */ 39 | -------------------------------------------------------------------------------- /include/stdext/posix/getopt.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/getopt.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_GETOPT_H 20 | #define STDEXT_POSIX_GETOPT_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_OS_WINDOWS) 29 | #include "../../../getopt/getopt.h" 30 | #else 31 | #ifndef _GETOPT_H 32 | #include 33 | #endif 34 | #endif 35 | 36 | // ------------------------------------------------------------------------- 37 | 38 | #endif /* STDEXT_POSIX_GETOPT_H */ 39 | -------------------------------------------------------------------------------- /include/stdext/posix/stdio.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/stdio.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_STDIO_H 20 | #define STDEXT_POSIX_STDIO_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_OS_WINDOWS) 29 | #include "popen/windows.h" 30 | #else 31 | typedef FILE* PFILE; 32 | #endif 33 | 34 | // ------------------------------------------------------------------------- 35 | 36 | #endif /* STDEXT_POSIX_STDIO_H */ 37 | -------------------------------------------------------------------------------- /include/stdext/posix/sys/stat.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/sys/stat.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_SYS_STAT_H 20 | #define STDEXT_POSIX_SYS_STAT_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_OS_WINDOWS) 29 | 30 | #ifndef _INC_STAT 31 | #include 32 | #endif 33 | 34 | #ifndef S_ISDIR 35 | #define S_ISDIR(mode) ((mode) & _S_IFDIR) 36 | #endif 37 | 38 | #else 39 | 40 | #ifndef _STAT_H 41 | #include 42 | #endif 43 | 44 | #endif 45 | 46 | // ------------------------------------------------------------------------- 47 | 48 | #endif /* STDEXT_POSIX_SYS_STAT_H */ 49 | -------------------------------------------------------------------------------- /include/stdext/posix/time.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/time.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_TIME_H 20 | #define STDEXT_POSIX_TIME_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_CC_VC) 29 | 30 | #ifndef _INC_TIME 31 | #include 32 | #endif 33 | 34 | inline struct tm* localtime_r(const time_t* timep, struct tm* result) 35 | { 36 | localtime_s(result, timep); 37 | return result; 38 | } 39 | 40 | #else 41 | #ifndef _TIME_H 42 | #include 43 | #endif 44 | #endif 45 | 46 | // ------------------------------------------------------------------------- 47 | 48 | #endif /* STDEXT_POSIX_TIME_H */ 49 | -------------------------------------------------------------------------------- /include/stdext/posix/unistd.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/posix/unistd.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-2-2 1:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_POSIX_UNISTD_H 20 | #define STDEXT_POSIX_UNISTD_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(X_OS_WINDOWS) 29 | 30 | #ifndef _INC_IO 31 | #include 32 | #endif 33 | 34 | #ifndef _INC_FCNTL 35 | #include 36 | #endif 37 | 38 | inline int winx_call ftruncate(int fd, off_t length) 39 | { 40 | #if defined(X_CC_VC6) 41 | return _chsize(fd, length); 42 | #else 43 | const errno_t e = _chsize_s(fd, length); 44 | return e == 0 ? 0 : -1; 45 | #endif 46 | } 47 | 48 | inline int winx_call truncate(const char* path, off_t length) /* Truncate PATH to LENGTH bytes. */ 49 | { 50 | int fd, ret, save; 51 | 52 | fd = _open(path, O_WRONLY); 53 | if (fd < 0) 54 | return -1; 55 | 56 | ret = ftruncate(fd, length); 57 | save = errno; 58 | _close(fd); 59 | if (ret < 0) 60 | errno = save; 61 | 62 | return ret; 63 | } 64 | 65 | #else 66 | 67 | #ifndef _UNISTD_H 68 | #include 69 | #endif 70 | 71 | #ifndef _SYS_TYPES_H 72 | #include 73 | #endif 74 | 75 | #endif 76 | 77 | // ------------------------------------------------------------------------- 78 | 79 | #endif /* STDEXT_POSIX_UNISTD_H */ 80 | -------------------------------------------------------------------------------- /include/stdext/pthread.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/pthread.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2003-10-5 13:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_PTHREAD_H 20 | #define STDEXT_PTHREAD_H 21 | 22 | // ------------------------------------------------------------------------- 23 | // pthread.h 24 | 25 | #if defined(_WIN32) 26 | #if !defined( PTHREAD_H ) 27 | #include "../../../pthreads-w32/include/pthread.h" 28 | #endif 29 | #pragma comment(lib, "pthreadVC2.lib") 30 | #else 31 | #ifndef _PTHREAD_H 32 | #include 33 | #endif 34 | #endif 35 | 36 | // ------------------------------------------------------------------------- 37 | // $Log: $ 38 | 39 | #endif /* STDEXT_PTHREAD_H */ 40 | -------------------------------------------------------------------------------- /include/stdext/scopedbg/CheckException.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/include/stdext/scopedbg/CheckException.h -------------------------------------------------------------------------------- /include/stdext/sgi/algorithm.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/algorithm.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: algorithm.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_ALGORITHM_H__ 20 | #define __SGI_ALGORITHM_H__ 21 | 22 | #ifndef __SGI_CONFIG_H__ 23 | #include "config.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // algorithm.h 28 | 29 | #if defined(X_STL_GCC) 30 | #ifndef __SGI_GCC_ALGORITHM_H__ 31 | #include "gcc/algorithm.h" 32 | #endif 33 | #else 34 | #ifndef __SGI_STL_ALGORITHM 35 | #include "../../../../stl/algorithm" 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: algorithm.h,v $ 41 | 42 | #endif /* __SGI_ALGORITHM_H__ */ 43 | -------------------------------------------------------------------------------- /include/stdext/sgi/functional.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/functional.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: functional.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_FUNCTIONAL_H__ 20 | #define __SGI_FUNCTIONAL_H__ 21 | 22 | #ifndef __SGI_CONFIG_H__ 23 | #include "config.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // functional.h 28 | 29 | #if defined(X_STL_GCC) 30 | #ifndef __SGI_GCC_FUNCTIONAL_H__ 31 | #include "gcc/functional.h" 32 | #endif 33 | #else 34 | #ifndef __SGI_STL_FUNCTIONAL 35 | #include "../../../../stl/functional" 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: functional.h,v $ 41 | 42 | #endif /* __SGI_FUNCTIONAL_H__ */ 43 | -------------------------------------------------------------------------------- /include/stdext/sgi/gcc/functional.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/gcc/functional.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: functional.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_GCC_FUNCTIONAL_H__ 20 | #define __SGI_GCC_FUNCTIONAL_H__ 21 | 22 | #if !defined(X_STL_GCC) 23 | #error "only for compiling sgi-stl for gcc" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if !defined(_FUNCTIONAL) 29 | #include 30 | #endif 31 | 32 | #if !defined(_EXT_FUNCTIONAL) 33 | #include 34 | #endif 35 | 36 | namespace __STD 37 | { 38 | using std::binary_function; 39 | using std::min; 40 | using std::max; 41 | }; 42 | 43 | // ------------------------------------------------------------------------- 44 | // $Log: functional.h,v $ 45 | 46 | #endif /* __SGI_GCC_FUNCTIONAL_H__ */ 47 | -------------------------------------------------------------------------------- /include/stdext/sgi/gcc/hashtable.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/gcc/hashtable.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: string.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_GCC_HASHTABLE_H__ 20 | #define __SGI_GCC_HASHTABLE_H__ 21 | 22 | #if !defined(X_STL_GCC) 23 | #error "only for compiling sgi-stl for gcc" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #ifndef _HASH_MAP 29 | #include 30 | #endif 31 | 32 | #ifndef __SGI_STL_HASH_FUN_H 33 | #define __SGI_STL_HASH_FUN_H 34 | #endif 35 | 36 | #ifndef __SGI_STL_HASHTABLE_H 37 | #define __SGI_STL_HASHTABLE_H 38 | #endif 39 | 40 | #ifndef __SGI_STL_INTERNAL_HASHTABLE_H 41 | #define __SGI_STL_INTERNAL_HASHTABLE_H 42 | #endif 43 | 44 | // ------------------------------------------------------------------------- 45 | // $Log: string.h,v $ 46 | 47 | #endif /* __SGI_GCC_HASHTABLE_H__ */ 48 | -------------------------------------------------------------------------------- /include/stdext/sgi/gcc/numeric.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/gcc/numeric.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: numeric.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_GCC_NUMERIC_H__ 20 | #define __SGI_GCC_NUMERIC_H__ 21 | 22 | #if !defined(X_STL_GCC) 23 | #error "only for compiling sgi-stl for gcc" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if !defined(_NUMERIC) 29 | #include 30 | #endif 31 | 32 | #ifndef _EXT_NUMERIC 33 | #include 34 | #endif 35 | 36 | #ifndef __SGI_STL_INTERNAL_NUMERIC_H 37 | #define __SGI_STL_INTERNAL_NUMERIC_H 38 | #endif 39 | 40 | namespace __STD 41 | { 42 | using std::accumulate; 43 | using std::inner_product; 44 | using std::partial_sum; 45 | using std::adjacent_difference; 46 | }; 47 | 48 | // ------------------------------------------------------------------------- 49 | // $Log: numeric.h,v $ 50 | 51 | #endif /* __SGI_GCC_NUMERIC_H__ */ 52 | -------------------------------------------------------------------------------- /include/stdext/sgi/gcc/string.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/gcc/string.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: string.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_GCC_STRING_H__ 20 | #define __SGI_GCC_STRING_H__ 21 | 22 | #if !defined(X_STL_GCC) 23 | #error "only for compiling sgi-stl for gcc" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #ifndef _STRING 29 | #include 30 | #endif 31 | 32 | #ifndef __SGI_STL_STRING 33 | #define __SGI_STL_STRING 34 | #endif 35 | 36 | #ifndef __SGI_STL_STRING_FWD_H 37 | #define __SGI_STL_STRING_FWD_H 38 | #endif 39 | 40 | // ------------------------------------------------------------------------- 41 | 42 | namespace __STD 43 | { 44 | inline const char* __get_c_string(const std::string& __s) 45 | { 46 | return __s.c_str(); 47 | } 48 | 49 | using std::allocator; 50 | using std::basic_string; 51 | using std::string; 52 | using std::wstring; 53 | } 54 | 55 | // ------------------------------------------------------------------------- 56 | // $Log: string.h,v $ 57 | 58 | #endif /* __SGI_GCC_STRING_H__ */ 59 | -------------------------------------------------------------------------------- /include/stdext/sgi/hash_map.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/hash_map.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: hash_map.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_HASH_MAP_H__ 20 | #define __SGI_HASH_MAP_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // hash_map/hash_multimap 24 | 25 | #ifndef __SGI_CONFIG_H__ 26 | #include "config.h" 27 | #endif 28 | 29 | #ifndef __SGI_VECTOR_H__ 30 | #include "vector.h" 31 | #endif 32 | 33 | #ifndef __SGI_ITERATOR_H__ 34 | #include "iterator.h" 35 | #endif 36 | 37 | #if defined(__STL_NEED_TYPENAME) 38 | #define typename 39 | #endif 40 | 41 | #ifndef __TYPE_TRAITS_H 42 | #include "../../../../stl/type_traits.h" 43 | #endif 44 | 45 | #ifndef __SGI_STL_INTERNAL_PAIR_H 46 | #include "../../../../stl/stl_pair.h" 47 | #endif 48 | 49 | #ifndef __SGI_STL_INTERNAL_HASHTABLE_H 50 | #include "../../../../stl/stl_hashtable.h" 51 | #endif 52 | 53 | #ifndef __SGI_STL_HASH_MAP_H 54 | #include "../../../../stl/hash_map.h" 55 | #endif 56 | 57 | #if defined(__STL_NEED_TYPENAME) 58 | #undef typename 59 | #endif 60 | 61 | // ------------------------------------------------------------------------- 62 | // $Log: hash_map.h,v $ 63 | 64 | #endif /* __SGI_HASH_MAP_H__ */ 65 | -------------------------------------------------------------------------------- /include/stdext/sgi/hash_set.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/hash_set.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: hash_set.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_HASH_SET_H__ 20 | #define __SGI_HASH_SET_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // hash_set/hash_multiset 24 | 25 | #ifndef __SGI_CONFIG_H__ 26 | #include "config.h" 27 | #endif 28 | 29 | #ifndef __SGI_VECTOR_H__ 30 | #include "vector.h" 31 | #endif 32 | 33 | #ifndef __SGI_ITERATOR_H__ 34 | #include "iterator.h" 35 | #endif 36 | 37 | #if defined(__STL_NEED_TYPENAME) 38 | #define typename 39 | #endif 40 | 41 | #ifndef __TYPE_TRAITS_H 42 | #include "../../../../stl/type_traits.h" 43 | #endif 44 | 45 | #ifndef __SGI_STL_INTERNAL_PAIR_H 46 | #include "../../../../stl/stl_pair.h" 47 | #endif 48 | 49 | #ifndef __SGI_STL_INTERNAL_HASHTABLE_H 50 | #include "../../../../stl/stl_hashtable.h" 51 | #endif 52 | 53 | #ifndef __SGI_STL_HASH_SET_H 54 | #include "../../../../stl/hash_set.h" 55 | #endif 56 | 57 | #if defined(__STL_NEED_TYPENAME) 58 | #undef typename 59 | #endif 60 | 61 | // ------------------------------------------------------------------------- 62 | // $Log: hash_set.h,v $ 63 | 64 | #endif /* __SGI_HASH_SET_H__ */ 65 | -------------------------------------------------------------------------------- /include/stdext/sgi/iterator.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/iterator.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: iterator.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_ITERATOR_H__ 20 | #define __SGI_ITERATOR_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // iterator.h 24 | 25 | #if defined(X_STL_GCC) 26 | #ifndef __SGI_GCC_ITERATOR_H__ 27 | #include "gcc/iterator.h" 28 | #endif 29 | #elif defined(X_STL_NET) 30 | #ifndef __SGI_VC8_ITERATOR_H__ 31 | #include "vc8/iterator.h" 32 | #endif 33 | #else 34 | #ifndef __SGI_STL_ITERATOR 35 | #include "../../../../stl/iterator" 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: iterator.h,v $ 41 | 42 | #endif /* __SGI_ITERATOR_H__ */ 43 | -------------------------------------------------------------------------------- /include/stdext/sgi/list.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/list.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: list.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_LIST_H__ 20 | #define __SGI_LIST_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // list 24 | 25 | #ifndef __SGI_CONFIG_H__ 26 | #include "config.h" 27 | #endif 28 | 29 | #ifndef __SGI_ITERATOR_H__ 30 | #include "iterator.h" 31 | #endif 32 | 33 | #if defined(X_STL_SGI) 34 | #ifndef __SGI_STL_LIST_H 35 | #include "../../../../stl/list.h" 36 | #endif 37 | #else 38 | #ifndef _LIST_ 39 | #include 40 | #endif 41 | #endif 42 | 43 | #ifndef __SGI_STL_INTERNAL_LIST_H 44 | #define __SGI_STL_INTERNAL_LIST_H 45 | #endif 46 | 47 | // ------------------------------------------------------------------------- 48 | 49 | namespace __STD 50 | { 51 | using std::list; 52 | } 53 | 54 | // ------------------------------------------------------------------------- 55 | // slist 56 | 57 | #if defined(X_STL_GCC) 58 | #ifndef _SLIST 59 | #include 60 | #endif 61 | #else 62 | #ifndef __SGI_STL_SLIST_H 63 | #include "../../../../stl/slist.h" 64 | #endif 65 | #endif 66 | 67 | // ------------------------------------------------------------------------- 68 | // $Log: list.h,v $ 69 | // 70 | 71 | #endif /* __SGI_LIST_H__ */ 72 | -------------------------------------------------------------------------------- /include/stdext/sgi/numeric.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/numeric.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: numeric.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_NUMERIC_H__ 20 | #define __SGI_NUMERIC_H__ 21 | 22 | #ifndef __SGI_CONFIG_H__ 23 | #include "config.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // numeric.h 28 | 29 | #if defined(X_STL_GCC) 30 | #ifndef __SGI_GCC_NUMERIC_H__ 31 | #include "gcc/numeric.h" 32 | #endif 33 | #else 34 | #ifndef __SGI_STL_NUMERIC 35 | #include "../../../../stl/numeric" 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: numeric.h,v $ 41 | 42 | #endif /* __SGI_NUMERIC_H__ */ 43 | -------------------------------------------------------------------------------- /include/stdext/sgi/rope.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/rope.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: rope.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_ROPE_H__ 20 | #define __SGI_ROPE_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // class rope 24 | 25 | #ifndef __SGI_CONFIG_H__ 26 | #include "config.h" 27 | #endif 28 | 29 | #ifndef __SGI_ALGORITHM_H__ 30 | #include "algorithm.h" 31 | #endif 32 | 33 | #ifndef __SGI_STRING_H__ 34 | #include "string.h" 35 | #endif 36 | 37 | #ifndef __SGI_VECTOR_H__ 38 | #include "vector.h" 39 | #endif 40 | 41 | #ifndef __SGI_NUMERIC_H__ 42 | #include "numeric.h" 43 | #endif 44 | 45 | #if defined(_MSC_VER) 46 | #pragma warning(disable:4355) 47 | #endif 48 | 49 | #if defined(X_STL_GCC) 50 | #ifndef __SGI_ITERATOR_H__ 51 | #include "iterator.h" 52 | #endif 53 | 54 | #ifndef __SGI_FUNCTIONAL_H__ 55 | #include "functional.h" 56 | #endif 57 | 58 | #ifndef __SGI_GCC_HASHTABLE_H__ 59 | #include "gcc/hashtable.h" 60 | #endif 61 | 62 | #ifdef __STL_USE_NEW_IOSTREAMS 63 | #ifndef _IOSTREAM 64 | #include 65 | #endif 66 | #endif 67 | 68 | #ifndef _EXT_MEMORY 69 | #include 70 | #endif 71 | 72 | namespace __STD { 73 | using std::basic_ostream; 74 | using std::ios; 75 | using std::length_error; 76 | }; 77 | #endif 78 | 79 | #define __GC 80 | #define GC_REGISTER_FINALIZER(a0, a1, a2, a3, a4) 81 | 82 | #if defined(_MSC_VER) 83 | #pragma warning(disable:4521) 84 | #pragma warning(disable:4522) 85 | #endif 86 | 87 | #ifndef __SGI_STL_ROPE_H 88 | #include "../../../../stl/rope.h" 89 | #endif 90 | 91 | #if defined(_MSC_VER) 92 | #pragma warning(default:4521) // multiple copy constructors specified 93 | #pragma warning(default:4522) // multiple assignment operators specified 94 | #endif 95 | 96 | #undef __GC 97 | #undef GC_REGISTER_FINALIZER 98 | 99 | #if defined(_MSC_VER) 100 | #pragma warning(default:4355) 101 | #endif 102 | 103 | // ------------------------------------------------------------------------- 104 | // $Log: rope.h,v $ 105 | 106 | #endif /* __SGI_ROPE_H__ */ 107 | -------------------------------------------------------------------------------- /include/stdext/sgi/string.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/string.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: string.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_STRING_H__ 20 | #define __SGI_STRING_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | // string.h 24 | 25 | #if defined(X_CC_VC6) 26 | #ifndef __SGI_VC6_STRING_H__ 27 | #include "vc6/string.h" 28 | #endif 29 | #elif defined(X_STL_GCC) 30 | #ifndef __SGI_GCC_STRING_H__ 31 | #include "gcc/string.h" 32 | #endif 33 | #else 34 | #ifndef __SGI_STL_STRING 35 | #include "../../../../stl/string" 36 | #endif 37 | #endif 38 | 39 | // ------------------------------------------------------------------------- 40 | // $Log: string.h,v $ 41 | 42 | #endif /* __SGI_STRING_H__ */ 43 | -------------------------------------------------------------------------------- /include/stdext/sgi/vc6/string.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/vc6/string.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: string.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_VC6_STRING_H__ 20 | #define __SGI_VC6_STRING_H__ 21 | 22 | #if !defined(X_CC_VC6) 23 | #error "only for compiling sgi-stl for vc6" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #ifndef _STRING_ 29 | #include 30 | #endif 31 | 32 | #ifndef __SGI_STL_STRING 33 | #define __SGI_STL_STRING 34 | #endif 35 | 36 | #ifndef __SGI_STL_STRING_FWD_H 37 | #define __SGI_STL_STRING_FWD_H 38 | #endif 39 | 40 | // ------------------------------------------------------------------------- 41 | 42 | namespace __STD 43 | { 44 | inline const char* __get_c_string(const std::string& __s) 45 | { 46 | return __s.c_str(); 47 | } 48 | 49 | using std::allocator; 50 | using std::basic_string; 51 | using std::string; 52 | using std::wstring; 53 | } 54 | 55 | // ------------------------------------------------------------------------- 56 | // $Log: string.h,v $ 57 | 58 | #endif /* __SGI_VC6_STRING_H__ */ 59 | -------------------------------------------------------------------------------- /include/stdext/sgi/vector.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: sgi/vector.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: vector.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef __SGI_VECTOR_H__ 20 | #define __SGI_VECTOR_H__ 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #if defined(X_STL_SGI) 25 | #ifndef __SGI_STL_VECTOR_H 26 | #include "../../../../stl/vector.h" 27 | #endif 28 | #else 29 | #if !defined(_VECTOR_) && !defined(_VECTOR) 30 | #include 31 | #endif 32 | #endif 33 | 34 | #ifndef __SGI_STL_INTERNAL_VECTOR_H 35 | #define __SGI_STL_INTERNAL_VECTOR_H 36 | #endif 37 | 38 | // ------------------------------------------------------------------------- 39 | 40 | namespace __STD 41 | { 42 | using std::vector; 43 | } 44 | 45 | // ------------------------------------------------------------------------- 46 | // $Log: vector.h,v $ 47 | 48 | #endif /* __SGI_VECTOR_H__ */ 49 | -------------------------------------------------------------------------------- /include/stdext/tchar.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/tchar.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-23 12:39:31 16 | // 17 | // $Id: tchar.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_TCHAR_H 20 | #define STDEXT_TCHAR_H 21 | 22 | #if !defined(_LIBC_LIMITS_H_) && !defined(_INC_LIMITS) 23 | #include 24 | #endif 25 | 26 | #if !defined(_WCHAR_H) && !defined(_INC_WCHAR) 27 | #include 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // template char type functions 34 | 35 | #define __template_xchar template __forceinline 36 | #define __template_xchar_inline __template_xchar 37 | #define __xcharfunc(name) name 38 | #define __xdecl 39 | 40 | namespace tchar { 41 | 42 | #include "tchar/itoa.h" 43 | #include "tchar/makepath.h" 44 | #include "tchar/memop.h" 45 | #include "tchar/splitpath.h" 46 | #include "tchar/strcat.h" 47 | #include "tchar/strchr.h" 48 | #include "tchar/strcmp.h" 49 | #include "tchar/strcspn.h" 50 | #include "tchar/strdup.h" 51 | #include "tchar/stricmp.h" 52 | #include "tchar/strlen.h" 53 | #include "tchar/strlwr.h" 54 | #include "tchar/strncmp.h" 55 | #include "tchar/strncpy.h" 56 | #include "tchar/strnicmp.h" 57 | #include "tchar/strrchr.h" 58 | #include "tchar/strspn.h" 59 | #include "tchar/strstr.h" 60 | #include "tchar/strupr.h" 61 | 62 | }; // namespace tchar 63 | 64 | #undef __xdecl 65 | #undef __xcharfunc 66 | #undef __template_xchar 67 | #undef __template_xchar_inline 68 | 69 | // <--- template char type functions 70 | 71 | // ------------------------------------------------------------------------- 72 | // $Log: tchar.h,v $ 73 | // Revision 1.1 2006/08/23 04:48:32 xushiwei 74 | // STL-Extension: 75 | // namespace std::tchar(std::tchar::strlen, std::tchar::strlwr, etc) 76 | // 77 | 78 | NS_STDEXT_END 79 | 80 | #endif /* STDEXT_TCHAR_H */ 81 | -------------------------------------------------------------------------------- /include/stdext/tchar/memop.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/tchar/memop.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-23 12:33:34 16 | // 17 | // $Id: memop.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_TCHAR_MEMOP_H 20 | #define STDEXT_TCHAR_MEMOP_H 21 | 22 | #ifndef __template_xchar_inline 23 | #define __template_xchar_inline // template inline 24 | #endif 25 | 26 | #ifndef __xdecl 27 | #define __xdecl // __cdecl 28 | #endif 29 | 30 | __template_xchar_inline 31 | const xchar* __xdecl __xcharfunc(memchr)(const xchar *_S, xchar _C, size_t _N) 32 | {for (; 0 < _N; ++_S, --_N) 33 | if (*_S == _C) 34 | return (_S); 35 | return (0); } 36 | 37 | __template_xchar_inline 38 | int __xdecl __xcharfunc(memcmp)(const xchar *_S1, const xchar *_S2, size_t _N) 39 | {for (; 0 < _N; ++_S1, ++_S2, --_N) 40 | if (*_S1 != *_S2) 41 | return (*_S1 < *_S2 ? -1 : +1); 42 | return (0); } 43 | 44 | __template_xchar_inline 45 | xchar* __xdecl __xcharfunc(memcpy)(xchar *_S1, const xchar *_S2, size_t _N) 46 | {xchar *_Su1 = _S1; 47 | for (; 0 < _N; ++_Su1, ++_S2, --_N) 48 | *_Su1 = *_S2; 49 | return (_S1); } 50 | 51 | __template_xchar_inline 52 | xchar* __xdecl __xcharfunc(memmove)(xchar *_S1, const xchar *_S2, size_t _N) 53 | {xchar *_Su1 = _S1; 54 | if (_S2 < _Su1 && _Su1 < _S2 + _N) 55 | for (_Su1 += _N, _S2 += _N; 0 < _N; --_N) 56 | *--_Su1 = *--_S2; 57 | else 58 | for (; 0 < _N; --_N) 59 | *_Su1++ = *_S2++; 60 | return (_S1); } 61 | 62 | __template_xchar_inline 63 | xchar* __xdecl __xcharfunc(memset)(xchar *_S, xchar _C, size_t _N) 64 | {xchar *_Su = _S; 65 | for (; 0 < _N; ++_Su, --_N) 66 | *_Su = _C; 67 | return (_S); } 68 | 69 | // ------------------------------------------------------------------------- 70 | // $Log: memop.h,v $ 71 | // Revision 1.1 2006/10/18 12:13:39 xushiwei 72 | // stdext as independent component 73 | // 74 | // Revision 1.1 2006/08/23 04:48:32 xushiwei 75 | // STL-Extension: 76 | // namespace std::tchar(std::tchar::strlen, std::tchar::strlwr, etc) 77 | // 78 | 79 | #endif /* STDEXT_TCHAR_MEMOP_H */ 80 | -------------------------------------------------------------------------------- /include/stdext/tchar/strcat.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *strcat.c - contains strcat() and strcpy() 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * strcat() appends one xchar string onto another. 8 | * strcpy() copies one xchar string into another. 9 | * 10 | * strcat() concatenates (appends) a copy of the source string to the 11 | * end of the destination string, returning the destination string. 12 | * Strings are wide-character strings. 13 | * 14 | * strcpy() copies the source string to the spot pointed to be 15 | * the destination string, returning the destination string. 16 | * Strings are wide-character strings. 17 | * 18 | *******************************************************************************/ 19 | 20 | #ifndef __template_xchar 21 | #define __template_xchar // template 22 | #endif 23 | 24 | #ifndef __xdecl 25 | #define __xdecl // __cdecl 26 | #endif 27 | 28 | /*** 29 | *xchar *strcat(dst, src) - concatenate (append) one xchar string to another 30 | * 31 | *Purpose: 32 | * Concatenates src onto the end of dest. Assumes enough 33 | * space in dest. 34 | * 35 | *Entry: 36 | * xchar *dst - xchar string to which "src" is to be appended 37 | * const xchar *src - xchar string to be appended to the end of "dst" 38 | * 39 | *Exit: 40 | * The address of "dst" 41 | * 42 | *Exceptions: 43 | * 44 | *******************************************************************************/ 45 | 46 | __template_xchar 47 | xchar * __xdecl __xcharfunc(strcat)(xchar * dst, const xchar* src) 48 | { 49 | xchar * cp = dst; 50 | 51 | while( *cp ) 52 | cp++; /* find end of dst */ 53 | 54 | while( *cp++ = *src++ ) ; /* Copy src to end of dst */ 55 | 56 | return( dst ); /* return dst */ 57 | 58 | } 59 | 60 | /*** 61 | *xchar *strcpy(dst, src) - copy one xchar string over another 62 | * 63 | *Purpose: 64 | * Copies the xchar string src into the spot specified by 65 | * dest; assumes enough room. 66 | * 67 | *Entry: 68 | * xchar * dst - xchar string over which "src" is to be copied 69 | * const xchar * src - xchar string to be copied over "dst" 70 | * 71 | *Exit: 72 | * The address of "dst" 73 | * 74 | *Exceptions: 75 | *******************************************************************************/ 76 | 77 | __template_xchar 78 | xchar * __xdecl __xcharfunc(strcpy)(xchar* dst, const xchar * src) 79 | { 80 | xchar* cp = dst; 81 | 82 | while( *cp++ = *src++ ) 83 | ; /* Copy src over dst */ 84 | 85 | return( dst ); 86 | } 87 | 88 | -------------------------------------------------------------------------------- /include/stdext/tchar/strchr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcschr.c - search a xchar string for a given xchar character 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines wcschr() - search a xchar string for a xchar character 8 | * 9 | *******************************************************************************/ 10 | 11 | #ifndef __template_xchar 12 | #define __template_xchar // template 13 | #endif 14 | 15 | #ifndef __xdecl 16 | #define __xdecl // __cdecl 17 | #endif 18 | 19 | /*** 20 | *xchar *wcschr(string, c) - search a string for a xchar character 21 | * 22 | *Purpose: 23 | * Searches a xchar string for a given xchar character, 24 | * which may be the null character L'\0'. 25 | * 26 | *Entry: 27 | * xchar *string - xchar string to search in 28 | * xchar c - xchar character to search for 29 | * 30 | *Exit: 31 | * returns pointer to the first occurence of c in string 32 | * returns NULL if c does not occur in string 33 | * 34 | *Exceptions: 35 | * 36 | *******************************************************************************/ 37 | 38 | __template_xchar 39 | xchar * __xdecl __xcharfunc(strchr)( 40 | const xchar * string, 41 | xchar ch 42 | ) 43 | { 44 | while (*string && *string != ch) 45 | string++; 46 | 47 | if (*string == ch) 48 | return (xchar*)string; 49 | return(NULL); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /include/stdext/tchar/strcmp.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcscmp.c - routine to compare two xchar strings (for equal, less, or greater) 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * Compares two wide-character strings, determining their lexical order. 8 | * 9 | *******************************************************************************/ 10 | 11 | #ifndef __template_xchar 12 | #define __template_xchar // template 13 | #endif 14 | 15 | #ifndef __xdecl 16 | #define __xdecl // __cdecl 17 | #endif 18 | 19 | /*** 20 | *wcscmp - compare two xchar strings, 21 | * returning less than, equal to, or greater than 22 | * 23 | *Purpose: 24 | * wcscmp compares two wide-character strings and returns an integer 25 | * to indicate whether the first is less than the second, the two are 26 | * equal, or whether the first is greater than the second. 27 | * 28 | * Comparison is done xchar by xchar on an UNSIGNED basis, which is to 29 | * say that Null xchar(0) is less than any other character. 30 | * 31 | *Entry: 32 | * const xchar * src - string for left-hand side of comparison 33 | * const xchar * dst - string for right-hand side of comparison 34 | * 35 | *Exit: 36 | * returns <0 if src < dst 37 | * returns =0 if src == dst 38 | * returns >0 if src > dst 39 | * 40 | *Exceptions: 41 | * 42 | *******************************************************************************/ 43 | 44 | __template_xchar 45 | int __xdecl __xcharfunc(strcmp)(const xchar * src, const xchar * dst) 46 | { 47 | int ret; 48 | while( !(ret = (int)*src - (int)*dst) && *dst ) 49 | ++src, ++dst; 50 | return ret; 51 | } 52 | 53 | __forceinline int __xdecl strcmp(const char* src, const char* dst) 54 | { 55 | return ::strcmp(src, dst); 56 | } 57 | 58 | __forceinline int __xdecl strcmp(const wchar_t* src, const wchar_t* dst) 59 | { 60 | return ::wcscmp(src, dst); 61 | } 62 | -------------------------------------------------------------------------------- /include/stdext/tchar/strcspn.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcscspn.c - find length of initial substring of wide characters 3 | * not in a control string 4 | * 5 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 6 | * 7 | *Purpose: 8 | * defines wcscspn()- finds the length of the initial substring of 9 | * a string consisting entirely of characters not in a control string 10 | * (wide-character strings). 11 | * 12 | *******************************************************************************/ 13 | 14 | #ifndef __template_xchar 15 | #define __template_xchar // template 16 | #endif 17 | 18 | #ifndef __xdecl 19 | #define __xdecl // __cdecl 20 | #endif 21 | 22 | /*** 23 | *size_t wcscspn(string, control) - search for init substring w/o control wchars 24 | * 25 | *Purpose: 26 | * returns the index of the first character in string that belongs 27 | * to the set of characters specified by control. This is equivalent 28 | * to the length of the length of the initial substring of string 29 | * composed entirely of characters not in control. Null chars not 30 | * considered (wide-character strings). 31 | * 32 | *Entry: 33 | * xchar *string - string to search 34 | * xchar *control - set of characters not allowed in init substring 35 | * 36 | *Exit: 37 | * returns the index of the first xchar in string 38 | * that is in the set of characters specified by control. 39 | * 40 | *Exceptions: 41 | * 42 | *******************************************************************************/ 43 | 44 | __template_xchar 45 | size_t __xdecl __xcharfunc(strcspn)( 46 | const xchar * string, 47 | const xchar * control 48 | ) 49 | { 50 | xchar *str = (xchar *) string; 51 | xchar *wcset; 52 | 53 | /* 1st char in control string stops search */ 54 | while (*str) { 55 | for (wcset = (xchar *)control; *wcset; wcset++) { 56 | if (*wcset == *str) { 57 | return str - string; 58 | } 59 | } 60 | str++; 61 | } 62 | return str - string; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /include/stdext/tchar/strdup.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsdup.c - duplicate a wide-character string in malloc'd memory 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines _wcsdup() - grab new memory, and duplicate the string into it 8 | * (wide-character). 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar // template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *xchar *_wcsdup(string) - duplicate string into malloc'd memory 22 | * 23 | *Purpose: 24 | * Allocates enough storage via malloc() for a copy of the 25 | * string, copies the string into the new memory, and returns 26 | * a pointer to it (wide-character). 27 | * 28 | *Entry: 29 | * xchar *string - string to copy into new memory 30 | * 31 | *Exit: 32 | * returns a pointer to the newly allocated storage with the 33 | * string in it. 34 | * 35 | * returns NULL if enough memory could not be allocated, or 36 | * string was NULL. 37 | * 38 | *Uses: 39 | * 40 | *Exceptions: 41 | * 42 | *******************************************************************************/ 43 | 44 | #if defined(X_CC_VC_NET) 45 | #pragma push_macro("strdup") 46 | #undef strdup 47 | #endif 48 | 49 | __template_xchar 50 | xchar * __xdecl __xcharfunc(strdup)( 51 | const xchar * string 52 | ) 53 | { 54 | xchar *memory; 55 | 56 | if (!string) 57 | return(NULL); 58 | 59 | if (memory = (xchar *) malloc((__xcharfunc(strlen)(string)+1) * sizeof(xchar))) 60 | return __xcharfunc(strcpy)(memory,string); 61 | 62 | return(NULL); 63 | } 64 | 65 | #if defined(X_CC_VC_NET) 66 | #pragma pop_macro("strdup") 67 | #endif 68 | -------------------------------------------------------------------------------- /include/stdext/tchar/stricmp.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsicmp.c - contains case-insensitive wide string comp routine _wcsicmp 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * contains _wcsicmp() 8 | * 9 | *******************************************************************************/ 10 | 11 | #ifndef __template_xchar 12 | #define __template_xchar // template 13 | #endif 14 | 15 | #ifndef __xdecl 16 | #define __xdecl // __xdecl 17 | #endif 18 | 19 | /*** 20 | *int _wcsicmp(dst, src) - compare wide-character strings, ignore case 21 | * 22 | *Purpose: 23 | * _wcsicmp perform a case-insensitive xchar string comparision. 24 | * _wcsicmp is independent of locale. 25 | * 26 | *Entry: 27 | * xchar *dst, *src - strings to compare 28 | * 29 | *Return: 30 | * <0 if dst < src 31 | * 0 if dst = src 32 | * >0 if dst > src 33 | * This range of return values may differ from other *cmp|*coll functions. 34 | * 35 | *Exceptions: 36 | * 37 | *******************************************************************************/ 38 | 39 | __template_xchar 40 | int __xdecl __xcharfunc(stricmp)( 41 | const xchar * dst, 42 | const xchar * src 43 | ) 44 | { 45 | xchar f,l; 46 | 47 | do { 48 | f = ((*dst <= 'Z') && (*dst >= 'A')) 49 | ? *dst + 'a' - 'A' 50 | : *dst; 51 | l = ((*src <= 'Z') && (*src >= 'A')) 52 | ? *src + 'a' - 'A' 53 | : *src; 54 | dst++; 55 | src++; 56 | } while ( (f) && (f == l) ); 57 | 58 | return (int)(f - l); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /include/stdext/tchar/strlen.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcslen.c - contains wcslen() routine 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * wcslen returns the length of a null-terminated wide-character string, 8 | * not including the null xchar itself. 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *wcslen - return the length of a null-terminated wide-character string 22 | * 23 | *Purpose: 24 | * Finds the length in xchar's of the given string, not including 25 | * the final null xchar (wide-characters). 26 | * 27 | *Entry: 28 | * const xchar * wcs - string whose length is to be computed 29 | * 30 | *Exit: 31 | * length of the string "wcs", exclusive of the final null xchar 32 | * 33 | *Exceptions: 34 | * 35 | *******************************************************************************/ 36 | 37 | __template_xchar 38 | size_t __xdecl __xcharfunc(strlen)( 39 | const xchar * wcs 40 | ) 41 | { 42 | const xchar *eos = wcs; 43 | 44 | while( *eos++ ) ; 45 | 46 | return( (size_t)(eos - wcs - 1) ); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /include/stdext/tchar/strlwr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcslwr.c - routine to map upper-case characters in a xchar string 3 | * to lower-case 4 | * 5 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 6 | * 7 | *Purpose: 8 | * Converts all the upper case characters in a xchar string 9 | * to lower case, in place. 10 | * 11 | *******************************************************************************/ 12 | 13 | #ifndef __template_xchar 14 | #define __template_xchar // template 15 | #endif 16 | 17 | #ifndef __xdecl 18 | #define __xdecl // __cdecl 19 | #endif 20 | 21 | /*** 22 | *xchar *_wcslwr(string) - map upper-case characters in a string to lower-case 23 | * 24 | *Purpose: 25 | * wcslwr converts upper-case characters in a null-terminated xchar 26 | * string to their lower-case equivalents. The result may be longer or 27 | * shorter than the original string. Assumes enough space in string 28 | * to hold the result. 29 | * 30 | *Entry: 31 | * xchar *wsrc - xchar string to change to lower case 32 | * 33 | *Exit: 34 | * input string address 35 | * 36 | *Exceptions: 37 | * on an error, the original string is unaltered 38 | * 39 | *******************************************************************************/ 40 | 41 | __template_xchar 42 | xchar * __xdecl __xcharfunc(strlwr)( 43 | xchar * wsrc 44 | ) 45 | { 46 | xchar *p; /* traverses string for C locale conversion */ 47 | xchar *wdst = NULL; /* wide version of string in alternate case */ 48 | //int dstlen; /* len of wdst string, wide chars, with null */ 49 | 50 | for (p=wsrc; *p; p++) 51 | { 52 | if ( (*p >= 'A') && (*p <= 'Z') ) 53 | *p = *p - 'A' + 'a'; 54 | } 55 | return (wsrc); 56 | } 57 | 58 | -------------------------------------------------------------------------------- /include/stdext/tchar/strncmp.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsncmp.c - compare first n characters of two wide-character strings 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines wcsncmp() - compare first n characters of two xchar strings 8 | * for lexical order. 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar // template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *int wcsncmp(first, last, count) - compare first count chars of xchar strings 22 | * 23 | *Purpose: 24 | * Compares two strings for lexical order. The comparison stops 25 | * after: (1) a difference between the strings is found, (2) the end 26 | * of the strings is reached, or (3) count characters have been 27 | * compared (wide-character strings). 28 | * 29 | *Entry: 30 | * xchar *first, *last - strings to compare 31 | * size_t count - maximum number of characters to compare 32 | * 33 | *Exit: 34 | * returns <0 if first < last 35 | * returns 0 if first == last 36 | * returns >0 if first > last 37 | * 38 | *Exceptions: 39 | * 40 | *******************************************************************************/ 41 | 42 | __template_xchar 43 | int __xdecl __xcharfunc(strncmp)( 44 | const xchar * first, 45 | const xchar * last, 46 | size_t count 47 | ) 48 | { 49 | if (!count) 50 | return(0); 51 | 52 | while (--count && *first && *first == *last) 53 | { 54 | first++; 55 | last++; 56 | } 57 | 58 | return((int)(*first - *last)); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /include/stdext/tchar/strncpy.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsncpy.c - copy at most n characters of wide-character string 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines wcsncpy() - copy at most n characters of xchar string 8 | * 9 | *******************************************************************************/ 10 | 11 | #ifndef __template_xchar 12 | #define __template_xchar template 13 | #endif 14 | 15 | #ifndef __xdecl 16 | #define __xdecl // __cdecl 17 | #endif 18 | 19 | /*** 20 | *xchar *wcsncpy(dest, source, count) - copy at most n wide characters 21 | * 22 | *Purpose: 23 | * Copies count characters from the source string to the 24 | * destination. If count is less than the length of source, 25 | * NO NULL CHARACTER is put onto the end of the copied string. 26 | * If count is greater than the length of sources, dest is padded 27 | * with null characters to length count (wide-characters). 28 | * 29 | * 30 | *Entry: 31 | * xchar *dest - pointer to destination 32 | * xchar *source - source string for copy 33 | * size_t count - max number of characters to copy 34 | * 35 | *Exit: 36 | * returns dest 37 | * 38 | *Exceptions: 39 | * 40 | *******************************************************************************/ 41 | 42 | __template_xchar 43 | xchar * __xdecl __xcharfunc(strncpy)( 44 | xchar * dest, 45 | const xchar * source, 46 | size_t count 47 | ) 48 | { 49 | xchar *start = dest; 50 | 51 | while (count && (*dest++ = *source++)) /* copy string */ 52 | count--; 53 | 54 | if (count) /* pad out with zeroes */ 55 | while (--count) 56 | *dest++ = L'\0'; 57 | 58 | return(start); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /include/stdext/tchar/strnicmp.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsnicmp.c - compare n chars of wide-character strings, ignoring case 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines _wcsnicmp() - Compares at most n characters of two xchar 8 | * strings, without regard to case. 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar // template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *int _wcsnicmp(first, last, count) - compares count xchar of strings, 22 | * ignore case 23 | * 24 | *Purpose: 25 | * Compare the two strings for lexical order. Stops the comparison 26 | * when the following occurs: (1) strings differ, (2) the end of the 27 | * strings is reached, or (3) count characters have been compared. 28 | * For the purposes of the comparison, upper case characters are 29 | * converted to lower case (wide-characters). 30 | * 31 | *Entry: 32 | * xchar *first, *last - strings to compare 33 | * size_t count - maximum number of characters to compare 34 | * 35 | *Exit: 36 | * -1 if first < last 37 | * 0 if first == last 38 | * 1 if first > last 39 | * This range of return values may differ from other *cmp|*coll functions. 40 | * 41 | *Exceptions: 42 | * 43 | *******************************************************************************/ 44 | 45 | __template_xchar 46 | int __xdecl __xcharfunc(strnicmp) ( 47 | const xchar * first, 48 | const xchar * last, 49 | size_t count 50 | ) 51 | { 52 | xchar f,l; 53 | int result = 0; 54 | 55 | if ( count ) { 56 | do { 57 | f = ((*first <= L'Z') && (*first >= L'A')) 58 | ? *first - L'A' + L'a' 59 | : *first; 60 | l = ((*last <= L'Z') && (*last >= L'A')) 61 | ? *last - L'A' + L'a' 62 | : *last; 63 | first++; 64 | last++; 65 | } while ( (--count) && f && (f == l) ); 66 | 67 | result = (int)(f - l); 68 | } 69 | return result; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /include/stdext/tchar/strrchr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsrchr.c - find last occurrence of xchar character in wide string 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines wcsrchr() - find the last occurrence of a given character 8 | * in a string (wide-characters). 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar // template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *xchar *wcsrchr(string, ch) - find last occurrence of ch in wide string 22 | * 23 | *Purpose: 24 | * Finds the last occurrence of ch in string. The terminating 25 | * null character is used as part of the search (wide-characters). 26 | * 27 | *Entry: 28 | * xchar *string - string to search in 29 | * xchar ch - character to search for 30 | * 31 | *Exit: 32 | * returns a pointer to the last occurrence of ch in the given 33 | * string 34 | * returns NULL if ch does not occurr in the string 35 | * 36 | *Exceptions: 37 | * 38 | *******************************************************************************/ 39 | 40 | __template_xchar 41 | xchar * __xdecl __xcharfunc(strrchr)( 42 | const xchar * string, 43 | xchar ch 44 | ) 45 | { 46 | xchar *start = (xchar *)string; 47 | 48 | while (*string++) /* find end of string */ 49 | ; 50 | /* search towards front */ 51 | while (--string != start && *string != (xchar)ch) 52 | ; 53 | 54 | if (*string == (xchar)ch) /* xchar found ? */ 55 | return( (xchar *)string ); 56 | 57 | return(NULL); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /include/stdext/tchar/strspn.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *wcsspn.c - find length of initial substring of chars from a control string 3 | * (wide-character strings) 4 | * 5 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 6 | * 7 | *Purpose: 8 | * defines wcsspn() - finds the length of the initial substring of 9 | * a string consisting entirely of characters from a control string 10 | * (wide-character strings). 11 | * 12 | *******************************************************************************/ 13 | 14 | #ifndef __template_xchar 15 | #define __template_xchar // template 16 | #endif 17 | 18 | #ifndef __xdecl 19 | #define __xdecl // __cdecl 20 | #endif 21 | 22 | /*** 23 | *int wcsspn(string, control) - find init substring of control chars 24 | * 25 | *Purpose: 26 | * Finds the index of the first character in string that does belong 27 | * to the set of characters specified by control. This is 28 | * equivalent to the length of the initial substring of string that 29 | * consists entirely of characters from control. The L'\0' character 30 | * that terminates control is not considered in the matching process 31 | * (wide-character strings). 32 | * 33 | *Entry: 34 | * xchar *string - string to search 35 | * xchar *control - string containing characters not to search for 36 | * 37 | *Exit: 38 | * returns index of first xchar in string not in control 39 | * 40 | *Exceptions: 41 | * 42 | *******************************************************************************/ 43 | 44 | __template_xchar 45 | size_t __xdecl __xcharfunc(strspn)( 46 | const xchar * string, 47 | const xchar * control 48 | ) 49 | { 50 | xchar *str = (xchar *) string; 51 | xchar *ctl; 52 | 53 | /* 1st char not in control string stops search */ 54 | while (*str) { 55 | for (ctl = (xchar *)control; *ctl != *str; ctl++) { 56 | if (*ctl == (xchar)0) { 57 | /* 58 | * reached end of control string without finding a match 59 | */ 60 | return str - string; 61 | } 62 | } 63 | str++; 64 | } 65 | /* 66 | * The whole string consisted of characters from control 67 | */ 68 | return str - string; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /include/stdext/tchar/strstr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *strstr.c - search for one string inside another 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * defines strstr() - search for one string inside another 8 | * 9 | *******************************************************************************/ 10 | 11 | #ifndef __template_xchar 12 | #define __template_xchar template inline 13 | #endif 14 | 15 | #ifndef __xdecl 16 | #define __xdecl // __cdecl 17 | #endif 18 | 19 | /*** 20 | *xchar *strstr(string1, string2) - search for string2 in string1 21 | * 22 | *Purpose: 23 | * finds the first occurrence of string2 in string1 24 | * 25 | *Entry: 26 | * xchar *string1 - string to search in 27 | * xchar *string2 - string to search for 28 | * 29 | *Exit: 30 | * returns a pointer to the first occurrence of string2 in 31 | * string1, or NULL if string2 does not occur in string1 32 | * 33 | *Uses: 34 | * 35 | *Exceptions: 36 | * 37 | *******************************************************************************/ 38 | 39 | __template_xchar 40 | xchar * __xdecl strstr ( 41 | const xchar * str1, 42 | const xchar * str2 43 | ) 44 | { 45 | xchar *cp = (xchar *) str1; 46 | xchar *s1, *s2; 47 | 48 | if ( !*str2 ) 49 | return((xchar *)str1); 50 | 51 | while (*cp) 52 | { 53 | s1 = cp; 54 | s2 = (xchar *) str2; 55 | 56 | while ( *s1 && *s2 && !(*s1-*s2) ) 57 | s1++, s2++; 58 | 59 | if (!*s2) 60 | return(cp); 61 | 62 | cp++; 63 | } 64 | 65 | return(NULL); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /include/stdext/tchar/strupr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *strupr.c - routine to map lower-case characters in a string to upper-case 3 | * 4 | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * Converts all the lower case characters in string to upper case 8 | * in place. 9 | * 10 | *******************************************************************************/ 11 | 12 | #ifndef __template_xchar 13 | #define __template_xchar template 14 | #endif 15 | 16 | #ifndef __xdecl 17 | #define __xdecl // __cdecl 18 | #endif 19 | 20 | /*** 21 | *char *_strupr(string) - map lower-case characters in a string to upper-case 22 | * 23 | *Purpose: 24 | * _strupr() converts lower-case characters in a null-terminated string 25 | * to their upper-case equivalents. Conversion is done in place and 26 | * characters other than lower-case letters are not modified. 27 | * 28 | * In the C locale, this function modifies only 7-bit ASCII characters 29 | * in the range 0x61 through 0x7A ('a' through 'z'). 30 | * 31 | * If the locale is not the 'C' locale, MapStringW() is used to do 32 | * the work. Assumes enough space in the string to hold result. 33 | * 34 | *Entry: 35 | * char *string - string to change to upper case 36 | * 37 | *Exit: 38 | * input string address 39 | * 40 | *Exceptions: 41 | * The original string is returned unchanged on any error. 42 | * 43 | *******************************************************************************/ 44 | 45 | __template_xchar 46 | xchar* __xdecl __xcharfunc(strupr)(xchar* string) 47 | { 48 | xchar * cp; 49 | 50 | for (cp=string; *cp; ++cp) 51 | { 52 | if ('a' <= *cp && *cp <= 'z') 53 | *cp += 'A' - 'a'; 54 | } 55 | return(string); 56 | } 57 | -------------------------------------------------------------------------------- /include/stdext/text/Binary.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/text/Binary.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2010-7-22 22:56:07 16 | // 17 | // $Id: Binary.h,v 1.1 2010-7-22 22:56:07 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_TEXT_BINARY_H 20 | #define STDEXT_TEXT_BINARY_H 21 | 22 | #ifndef STDEXT_BASIC_H 23 | #include "../Basic.h" 24 | #endif 25 | 26 | #ifndef STDEXT_CHARTYPE_H 27 | #include "../CharType.h" 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // function bin2hex, hex2bin 34 | 35 | inline char* winx_call bin2hex( 36 | char* buf /* bytes * 2 */, const BYTE* bin /* bytes */, const size_t bytes) 37 | { 38 | const char* const hex = "0123456789abcdef"; 39 | for (const BYTE* binEnd = bin + bytes; bin != binEnd; ++bin) 40 | { 41 | *buf++ = hex[*(unsigned char*)bin >> 4]; 42 | *buf++ = hex[*bin & 0xf]; 43 | } 44 | return buf; 45 | } 46 | 47 | inline bool winx_call hex2bin( 48 | BYTE* bin /* bytes */, const size_t bytes, const char* buf /* bytes * 2 */) 49 | { 50 | typedef NS_STDEXT::DigitTable DigitTable; 51 | 52 | for (const BYTE* binEnd = bin + bytes; bin != binEnd; ++bin) 53 | { 54 | const unsigned c1 = DigitTable::toDigit(*buf++); 55 | const unsigned c2 = DigitTable::toDigit(*buf++); 56 | if (c1 >= 16 || c2 >= 16) 57 | return false; 58 | *bin = (c1 << 4) | c2; 59 | } 60 | return true; 61 | } 62 | 63 | // ------------------------------------------------------------------------- 64 | // function bin2hexStr 65 | 66 | inline const char* winx_call bin2hexStr( 67 | char* buf /* bytes * 2 + 1 */, const BYTE* bin /* bytes */, const size_t bytes) 68 | { 69 | *bin2hex(buf, bin, bytes) = '\0'; 70 | return buf; 71 | } 72 | 73 | // ------------------------------------------------------------------------- 74 | 75 | NS_STDEXT_END 76 | 77 | #endif /* STDEXT_TEXT_BINARY_H */ 78 | -------------------------------------------------------------------------------- /include/stdext/text/Encoding.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/text/Encoding.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: Encoding.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_TEXT_ENCODING_H 20 | #define STDEXT_TEXT_ENCODING_H 21 | 22 | #ifndef STDEXT_TEXT_STRINGALGO_H 23 | #include "StringAlgo.h" 24 | #endif 25 | 26 | #ifndef STD_MAP_H 27 | #include "../../std/map.h" 28 | #endif 29 | 30 | NS_STDEXT_BEGIN 31 | 32 | // ------------------------------------------------------------------------- 33 | // class EncodingSet 34 | 35 | namespace detail { 36 | 37 | typedef String Encoding; 38 | 39 | struct ICaseLess 40 | { 41 | bool winx_call operator()(const Encoding& a, const Encoding& b) const { 42 | return a.icompare(b) < 0; 43 | } 44 | }; 45 | 46 | typedef std::map BaseEncoding2CPMap; 47 | 48 | class Encoding2CPMap : public BaseEncoding2CPMap 49 | { 50 | public: 51 | struct Pair 52 | { 53 | const char* encoding; 54 | int cp; 55 | }; 56 | 57 | Encoding2CPMap() 58 | { 59 | const Pair pairs[] = 60 | { 61 | { "gbk", cp_gbk }, 62 | { "gb2312", cp_gbk }, 63 | { "utf-8", cp_utf8 }, 64 | { "utf8", cp_utf8 }, 65 | { "utf-7", cp_utf7 }, 66 | { "utf7", cp_utf7 }, 67 | { "big5", cp_big5 }, 68 | }; 69 | for (size_t i = 0; i < countof(pairs); ++i) 70 | { 71 | insert(value_type(pairs[i].encoding, pairs[i].cp)); 72 | } 73 | } 74 | }; 75 | 76 | } // namespace detail 77 | 78 | // ------------------------------------------------------------------------- 79 | // function getEncoding 80 | 81 | inline codepage_t winx_call getEncoding(const String& encoding, codepage_t cpError = cp_unknown) 82 | { 83 | using namespace detail; 84 | 85 | static const Encoding2CPMap g_map = Encoding2CPMap(); 86 | 87 | Encoding2CPMap::const_iterator it = g_map.find(encoding); 88 | if (it != g_map.end()) 89 | return (codepage_t)(*it).second; 90 | else 91 | return cpError; 92 | } 93 | 94 | // ------------------------------------------------------------------------- 95 | 96 | NS_STDEXT_END 97 | 98 | #endif /* STDEXT_TEXT_ENCODING_H */ 99 | -------------------------------------------------------------------------------- /include/stdext/text/Format.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/text/Format.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:56:07 16 | // 17 | // $Id: Format.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_TEXT_FORMAT_H 20 | #define STDEXT_TEXT_FORMAT_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | #ifndef STDEXT_TEXT_FORMAT_STR_H 25 | #include "format/str.h" 26 | #endif 27 | 28 | #ifndef STDEXT_TEXT_FORMAT_PRINTF_H 29 | #include "format/printf.h" 30 | #endif 31 | 32 | #ifndef STDEXT_TEXT_FORMAT_FORMATTER_H 33 | #include "format/formatter.h" 34 | #endif 35 | 36 | // ------------------------------------------------------------------------- 37 | 38 | #endif /* STDEXT_TEXT_FORMAT_H */ 39 | 40 | -------------------------------------------------------------------------------- /include/stdext/thread/Basic.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/thread/Basic.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: Basic.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_THREAD_BASIC_H 20 | #define STDEXT_THREAD_BASIC_H 21 | 22 | #ifndef STDEXT_WINAPI_WINBASE_H 23 | #include "../winapi/winbase.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if defined(_WIN32) || defined(_WIN64) 29 | #define STDEXT_THREAD_WINDOWS 30 | #endif 31 | 32 | // ------------------------------------------------------------------------- 33 | 34 | #if !defined(STDEXT_THREAD_WINDOWS) || defined(PTW32_VERSION) 35 | 36 | #ifndef _PTHREAD_H 37 | #include 38 | #endif 39 | 40 | #define STDEXT_HAS_PTHREAD 41 | 42 | #endif 43 | 44 | // ------------------------------------------------------------------------- 45 | 46 | #if !defined(STDEXT_THREAD_WINDOWS) 47 | 48 | #define STDEXT_HAS_ATOMIC_BUILTINS 49 | 50 | #endif 51 | 52 | // ------------------------------------------------------------------------- 53 | // $Log: $ 54 | 55 | #endif /* STDEXT_THREAD_BASIC_H */ 56 | -------------------------------------------------------------------------------- /include/stdext/thread/Event.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/thread/Event.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: Event.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_THREAD_EVENT_H 20 | #define STDEXT_THREAD_EVENT_H 21 | 22 | #ifndef STDEXT_THREAD_BASIC_H 23 | #include "Basic.h" 24 | #endif 25 | 26 | #if defined(X_OS_LINUX) 27 | #define STDEXT_POSIX_SEMAPHORE 28 | #ifndef _SEMAPHORE_H 29 | #include 30 | #endif 31 | #endif 32 | 33 | NS_STDEXT_BEGIN 34 | 35 | // ========================================================================= 36 | // class WinEvent 37 | 38 | #if defined(STDEXT_THREAD_WINDOWS) 39 | 40 | class WinEvent 41 | { 42 | private: 43 | WinEvent(const WinEvent&); 44 | void operator=(const WinEvent&); 45 | 46 | HANDLE hEvent; 47 | 48 | public: 49 | typedef size_t duration_type; 50 | 51 | public: 52 | WinEvent() { 53 | hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); 54 | } 55 | ~WinEvent() { 56 | CloseHandle(hEvent); 57 | } 58 | 59 | public: 60 | void winx_call acquire() { 61 | WaitForSingleObject(hEvent, INFINITE); 62 | } 63 | 64 | void winx_call release() { 65 | SetEvent(hEvent); 66 | } 67 | 68 | public: 69 | void winx_call wait() { 70 | WaitForSingleObject(hEvent, INFINITE); 71 | } 72 | 73 | bool winx_call timed_wait(duration_type ms) { 74 | return WaitForSingleObject(hEvent, (DWORD)ms) == WAIT_OBJECT_0; 75 | } 76 | 77 | void winx_call notify() { 78 | SetEvent(hEvent); 79 | } 80 | }; 81 | 82 | #endif // defined(STDEXT_THREAD_WINDOWS) 83 | 84 | // ========================================================================= 85 | // class PosixEvent 86 | 87 | #if defined(STDEXT_POSIX_SEMAPHORE) 88 | 89 | class PosixEvent 90 | { 91 | private: 92 | PosixEvent(const PosixEvent&); 93 | void operator=(const PosixEvent&); 94 | 95 | private: 96 | sem_t m_sem; 97 | 98 | public: 99 | explicit PosixEvent() { 100 | sem_init(&m_sem, 0, 0); 101 | } 102 | ~PosixEvent() { 103 | sem_destroy(&m_sem); 104 | } 105 | 106 | public: 107 | void winx_call acquire() { 108 | sem_wait(&m_sem); 109 | } 110 | 111 | void winx_call release() { 112 | sem_post(&m_sem); 113 | } 114 | 115 | public: 116 | void winx_call wait() { 117 | sem_wait(&m_sem); 118 | } 119 | 120 | void winx_call notify() { 121 | sem_post(&m_sem); 122 | } 123 | }; 124 | 125 | #endif 126 | 127 | // ========================================================================= 128 | // class Event 129 | 130 | #if defined(STDEXT_THREAD_WINDOWS) 131 | 132 | typedef WinEvent Event; 133 | 134 | #else 135 | 136 | typedef PosixEvent Event; 137 | 138 | #endif 139 | 140 | // ========================================================================= 141 | 142 | NS_STDEXT_END 143 | 144 | #endif /* CERL_THREAD_EVENT_H */ 145 | -------------------------------------------------------------------------------- /include/stdext/thread/RefCount.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/thread/RefCount.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: RefCount.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_THREAD_REFCOUNT_H 20 | #define STDEXT_THREAD_REFCOUNT_H 21 | 22 | #ifndef STDEXT_THREAD_BASIC_H 23 | #include "Basic.h" 24 | #endif 25 | 26 | NS_STDEXT_BEGIN 27 | 28 | // ========================================================================= 29 | // class RefCountMT 30 | 31 | class RefCountMT 32 | { 33 | public: 34 | typedef LONG value_type; 35 | 36 | private: 37 | value_type m_nRef; 38 | 39 | public: 40 | RefCountMT(value_type nRef) 41 | : m_nRef(nRef) 42 | { 43 | } 44 | 45 | value_type winx_call acquire() 46 | { 47 | return InterlockedIncrement(&m_nRef); 48 | } 49 | 50 | value_type winx_call release() 51 | { 52 | return InterlockedDecrement(&m_nRef); 53 | } 54 | 55 | operator value_type() 56 | { 57 | return m_nRef; 58 | } 59 | }; 60 | 61 | // ========================================================================= 62 | // class RefCountST 63 | 64 | class RefCountST 65 | { 66 | public: 67 | typedef long value_type; 68 | 69 | private: 70 | value_type m_nRef; 71 | 72 | public: 73 | RefCountST(value_type nRef) : m_nRef(nRef) 74 | { 75 | } 76 | 77 | value_type winx_call acquire() { return ++m_nRef; } 78 | value_type winx_call release() { return --m_nRef; } 79 | 80 | operator value_type() 81 | { 82 | return m_nRef; 83 | } 84 | }; 85 | 86 | // ========================================================================= 87 | // $Log: $ 88 | 89 | NS_STDEXT_END 90 | 91 | #endif /* STDEXT_THREAD_REFCOUNT_H */ 92 | -------------------------------------------------------------------------------- /include/stdext/thread/Semaphore.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/thread/Semaphore.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2004-4-5 20:30:40 16 | // 17 | // $Id: Semaphore.h,v 1.5 2006/12/26 10:54:04 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_THREAD_SEMAPHORE_H 20 | #define STDEXT_THREAD_SEMAPHORE_H 21 | 22 | #ifndef STDEXT_THREAD_BASIC_H 23 | #include "Basic.h" 24 | #endif 25 | 26 | #if defined(X_OS_LINUX) 27 | #define STDEXT_POSIX_SEMAPHORE 28 | #ifndef _SEMAPHORE_H 29 | #include 30 | #endif 31 | #endif 32 | 33 | NS_STDEXT_BEGIN 34 | 35 | // ========================================================================= 36 | // class WinSemaphore 37 | 38 | #if defined(STDEXT_THREAD_WINDOWS) 39 | 40 | class WinSemaphore 41 | { 42 | private: 43 | HANDLE m_sem; 44 | 45 | private: 46 | WinSemaphore(const WinSemaphore&); 47 | void operator=(const WinSemaphore&); 48 | 49 | public: 50 | typedef LONG value_type; 51 | 52 | public: 53 | explicit WinSemaphore(value_type lInitialCount = 0) 54 | { 55 | enum { MaxCount = 2147483647L }; 56 | m_sem = CreateSemaphore(NULL, lInitialCount, MaxCount, NULL); 57 | } 58 | ~WinSemaphore() 59 | { 60 | CloseHandle(m_sem); 61 | } 62 | 63 | void winx_call acquire() 64 | { 65 | WaitForSingleObject(m_sem, INFINITE); 66 | } 67 | 68 | void winx_call release() 69 | { 70 | ReleaseSemaphore(m_sem, 1, NULL); 71 | } 72 | }; 73 | 74 | #endif // defined(STDEXT_THREAD_WINDOWS) 75 | 76 | // ========================================================================= 77 | // class PosixSemaphore 78 | 79 | #if defined(STDEXT_POSIX_SEMAPHORE) 80 | 81 | class PosixSemaphore 82 | { 83 | private: 84 | PosixSemaphore(const PosixSemaphore&); 85 | void operator=(const PosixSemaphore&); 86 | 87 | private: 88 | sem_t m_sem; 89 | 90 | public: 91 | typedef unsigned value_type; 92 | 93 | public: 94 | explicit PosixSemaphore(value_type lInitialCount = 0) { 95 | sem_init(&m_sem, 0, lInitialCount); 96 | } 97 | ~PosixSemaphore() { 98 | sem_destroy(&m_sem); 99 | } 100 | 101 | void winx_call acquire() { 102 | sem_wait(&m_sem); 103 | } 104 | 105 | void winx_call release() { 106 | sem_post(&m_sem); 107 | } 108 | }; 109 | 110 | #endif 111 | 112 | // ========================================================================= 113 | // class Semaphore 114 | 115 | #if defined(STDEXT_THREAD_WINDOWS) 116 | 117 | typedef WinSemaphore Semaphore; 118 | 119 | #else 120 | 121 | typedef PosixSemaphore Semaphore; 122 | 123 | #endif 124 | 125 | // ========================================================================= 126 | 127 | NS_STDEXT_END 128 | 129 | #endif /* STDEXT_THREAD_SEMAPHORE_H */ 130 | -------------------------------------------------------------------------------- /include/stdext/vc/declspec.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/vc/declspec.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2003-10-5 13:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_VC_DECLSPEC_H 20 | #define STDEXT_VC_DECLSPEC_H 21 | 22 | // ========================================================================= 23 | // function calltype 24 | 25 | #if !defined(_MSC_VER) 26 | 27 | #ifndef __cdecl 28 | #define __cdecl 29 | #endif 30 | 31 | #ifndef __stdcall 32 | #define __stdcall // __attribute__((stdcall)) 33 | #endif 34 | 35 | #ifndef __fastcall 36 | #define __fastcall // __attribute__((fastcall)) 37 | #endif 38 | 39 | #ifndef __forceinline 40 | #define __forceinline inline 41 | #endif 42 | 43 | #endif 44 | 45 | // ========================================================================= 46 | // WINX_DEFINE_SELECTANY, WINX_SELECTANY 47 | 48 | #define _WINX_SELECTANY_CLS(Var) _TWinx ## Var 49 | #define _WINX_SELECTANY(Var, type) _TWinx ## Var::_g_inst 50 | 51 | #define WINX_DEFINE_SELECTANY(Type, Var) \ 52 | \ 53 | template \ 54 | struct _WINX_SELECTANY_CLS(Var) \ 55 | { \ 56 | static Type _g_inst; \ 57 | }; \ 58 | \ 59 | template \ 60 | Type _WINX_SELECTANY(Var, _Unused) 61 | 62 | #define WINX_SELECTANY(Var) _WINX_SELECTANY(Var, int) 63 | 64 | // ------------------------------------------------------------------------- 65 | // DEFINE_SELECTANY, SELECTANY 66 | 67 | #if defined(_MSC_VER) 68 | 69 | #define DEFINE_SELECTANY(Type, Var) __declspec(selectany) Type Var 70 | #define SELECTANY(Var) Var 71 | 72 | #else 73 | 74 | #define DEFINE_SELECTANY(Type, Var) WINX_DEFINE_SELECTANY(Type, Var) 75 | #define SELECTANY(Var) WINX_SELECTANY(Var) 76 | 77 | #endif 78 | 79 | // ========================================================================= 80 | // uuidof 81 | 82 | #ifndef STDEXT_VC_UUIDOF_H 83 | #include "uuidof.h" 84 | #endif 85 | 86 | #ifndef STDEXT_VC_PROPERTY_H 87 | #include "property.h" 88 | #endif 89 | 90 | // ========================================================================= 91 | // $Log: $ 92 | 93 | #endif /* STDEXT_VC_DECLSPEC_H */ 94 | -------------------------------------------------------------------------------- /include/stdext/winapi/atomic/atomic_builtins.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/atomic/atomic_builtins.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:08:57 16 | // 17 | // $Id: atomic_builtins.h,v 1.6 2007/01/10 09:38:10 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_ATOMIC_ATOMIC_BUILTINS_H 20 | #define STDEXT_WINAPI_ATOMIC_ATOMIC_BUILTINS_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | __forceinline LONG WINAPI InterlockedIncrement(volatile LPLONG lpAddend) 25 | { 26 | return __sync_add_and_fetch(lpAddend, 1); 27 | } 28 | 29 | __forceinline LONG WINAPI InterlockedDecrement(volatile LPLONG lpAddend) 30 | { 31 | return __sync_sub_and_fetch(lpAddend, 1); 32 | } 33 | 34 | // ------------------------------------------------------------------------- 35 | 36 | __forceinline LONG WINAPI InterlockedExchange(volatile LPLONG Target, LONG Value) 37 | { 38 | __sync_synchronize(); 39 | return __sync_lock_test_and_set(Target, Value); 40 | } 41 | 42 | __forceinline PVOID WINAPI InterlockedExchangePointer(volatile PVOID* Target, PVOID Value) 43 | { 44 | __sync_synchronize(); 45 | return (PVOID)__sync_lock_test_and_set(Target, Value); 46 | } 47 | 48 | // ------------------------------------------------------------------------- 49 | 50 | __forceinline LONG WINAPI InterlockedExchangeAdd(volatile LPLONG Addend, LONG Value) 51 | { 52 | return __sync_fetch_and_add(Addend, Value); 53 | } 54 | 55 | // ------------------------------------------------------------------------- 56 | 57 | __forceinline LONG WINAPI InterlockedCompareExchange( 58 | volatile LPLONG Destination, LONG Exchange, LONG Comperand) 59 | { 60 | return __sync_val_compare_and_swap(Destination, Comperand, Exchange); 61 | } 62 | 63 | __forceinline PVOID WINAPI InterlockedCompareExchangePointer( 64 | volatile PVOID* Destination, PVOID Exchange, PVOID Comperand) 65 | { 66 | return (PVOID)__sync_val_compare_and_swap(Destination, Comperand, Exchange); 67 | } 68 | 69 | // ------------------------------------------------------------------------- 70 | // InterlockedExchange64 71 | 72 | __forceinline LONG64 WINAPI InterlockedExchange64( 73 | volatile PLONG64 Target, LONG64 Value) 74 | { 75 | __sync_synchronize(); 76 | return __sync_lock_test_and_set(Target, Value); 77 | } 78 | 79 | // ------------------------------------------------------------------------- 80 | // $Log: $ 81 | 82 | #endif /* STDEXT_WINAPI_ATOMIC_ATOMIC_BUILTINS_H */ 83 | 84 | -------------------------------------------------------------------------------- /include/stdext/winapi/atomic/solaris.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/atomic/solaris.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:08:57 16 | // 17 | // $Id: solaris.h,v 1.6 2007/01/10 09:38:10 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_ATOMIC_SOLARIS_H 20 | #define STDEXT_WINAPI_ATOMIC_SOLARIS_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | __forceinline LONG WINAPI InterlockedIncrement(volatile LPLONG lpAddend) 25 | { 26 | return atomic_inc_32_nv(lpAddend); 27 | } 28 | 29 | __forceinline LONG WINAPI InterlockedDecrement(volatile LPLONG lpAddend) 30 | { 31 | return atomic_dec_32_nv(lpAddend); 32 | } 33 | 34 | // ------------------------------------------------------------------------- 35 | 36 | __forceinline LONG WINAPI InterlockedExchange(volatile LPLONG Target, LONG Value) 37 | { 38 | return atomic_swap_32(Target, Value); 39 | } 40 | 41 | __forceinline PVOID WINAPI InterlockedExchangePointer(volatile PVOID* Target, PVOID Value) 42 | { 43 | return atomic_swap_ptr(Target, Value); 44 | } 45 | 46 | // ------------------------------------------------------------------------- 47 | 48 | __forceinline LONG WINAPI InterlockedExchangeAdd(volatile LPLONG Addend, LONG Value) 49 | { 50 | return atomic_add_32_nv(Addend, Value) - Value; 51 | } 52 | 53 | // ------------------------------------------------------------------------- 54 | 55 | __forceinline LONG WINAPI InterlockedCompareExchange( 56 | volatile LPLONG Destination, LONG Exchange, LONG Comperand) 57 | { 58 | return atomic_cas_32(Destination, Comperand, Exchange); 59 | } 60 | 61 | __forceinline PVOID WINAPI InterlockedCompareExchangePointer( 62 | volatile PVOID* Destination, PVOID Exchange, PVOID Comperand) 63 | { 64 | return atomic_cas_ptr(Destination, Comperand, Exchange); 65 | } 66 | 67 | // ------------------------------------------------------------------------- 68 | // $Log: $ 69 | 70 | #endif /* BOOST_DETAIL_WINAPI_ATOMIC_SOLARIS_HPP */ 71 | -------------------------------------------------------------------------------- /include/stdext/winapi/atomic/windows.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/atomic/windows.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:08:57 16 | // 17 | // $Id: windows.h,v 1.6 2007/01/10 09:38:10 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_ATOMIC_WINDOWS_H 20 | #define STDEXT_WINAPI_ATOMIC_WINDOWS_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | // we use our own implementation of InterlockedExchangePointer because of problems with the one in system headers 25 | __forceinline PVOID WINAPI winx_InterlockedExchangePointer(PVOID* Target, PVOID Value) 26 | { 27 | return reinterpret_cast(static_cast( 28 | InterlockedExchange( 29 | reinterpret_cast(Target), 30 | static_cast(reinterpret_cast(Value)) 31 | ) 32 | )); 33 | } 34 | 35 | #undef InterlockedExchangePointer 36 | #define InterlockedExchangePointer winx_InterlockedExchangePointer 37 | 38 | // ------------------------------------------------------------------------- 39 | 40 | #if defined(WINX_DETAIL_WINSDK_VC6) 41 | 42 | __forceinline LONG WINAPI winx_InterlockedCompareExchange( 43 | LPLONG Destination, LONG Exchange, LONG Comperand) 44 | { 45 | return (LONG)InterlockedCompareExchange( 46 | (PVOID*)Destination, (PVOID)Exchange, (PVOID)Comperand); 47 | } 48 | 49 | __forceinline PVOID WINAPI winx_InterlockedCompareExchangePointer( 50 | PVOID* Destination, PVOID Exchange, PVOID Comperand) 51 | { 52 | return InterlockedCompareExchange( 53 | Destination, Exchange, Comperand); 54 | } 55 | 56 | #define InterlockedCompareExchange winx_InterlockedCompareExchange 57 | #define InterlockedCompareExchangePointer winx_InterlockedCompareExchangePointer 58 | 59 | #elif !defined(InterlockedCompareExchangePointer) 60 | 61 | __forceinline PVOID WINAPI winx_InterlockedCompareExchangePointer( 62 | PVOID* Destination, PVOID Exchange, PVOID Comperand) 63 | { 64 | return reinterpret_cast(static_cast( 65 | InterlockedCompareExchange( 66 | reinterpret_cast(Destination), 67 | static_cast(reinterpret_cast(Exchange)), 68 | static_cast(reinterpret_cast(Comperand)) 69 | ) 70 | )); 71 | } 72 | 73 | #define InterlockedCompareExchangePointer winx_InterlockedCompareExchangePointer 74 | 75 | #endif 76 | 77 | // ------------------------------------------------------------------------- 78 | // $Log: $ 79 | 80 | #endif /* STDEXT_WINAPI_ATOMIC_WINDOWS_H */ 81 | -------------------------------------------------------------------------------- /include/stdext/winapi/ole2.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/ole2.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2003-10-5 13:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_OLE2_H 20 | #define STDEXT_WINAPI_OLE2_H 21 | 22 | #ifndef STDEXT_WINAPI_OBJBASE_H 23 | #include "objbase.h" 24 | #endif 25 | 26 | #ifndef STDEXT_WINAPI_OLEAUTO_H 27 | #include "oleauto.h" 28 | #endif 29 | 30 | #define WINOLEAPI inline HRESULT STDAPICALLTYPE 31 | #define WINOLEAPI_(type) inline type STDAPICALLTYPE 32 | 33 | // ------------------------------------------------------------------------- 34 | /* Storage Utility APIs */ 35 | 36 | WINOLEAPI GetHGlobalFromILockBytes(LPLOCKBYTES plkbyt, HGLOBAL FAR* phglobal) 37 | { 38 | NotImplementFeature("GetHGlobalFromILockBytes"); 39 | return S_OK; 40 | } 41 | 42 | WINOLEAPI CreateILockBytesOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, 43 | LPLOCKBYTES FAR* pplkbyt) 44 | { 45 | NotImplementFeature("CreateILockBytesOnHGlobal"); 46 | return S_OK; 47 | } 48 | 49 | WINOLEAPI GetHGlobalFromStream(LPSTREAM pstm, HGLOBAL FAR* phglobal) 50 | { 51 | NotImplementFeature("GetHGlobalFromStream"); 52 | return S_OK; 53 | } 54 | 55 | WINOLEAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, 56 | LPSTREAM FAR* ppstm) 57 | { 58 | NotImplementFeature("CreateStreamOnHGlobal"); 59 | return S_OK; 60 | } 61 | 62 | // ------------------------------------------------------------------------- 63 | /* Clipboard APIs */ 64 | 65 | interface IDataObject; 66 | 67 | WINOLEAPI OleSetClipboard(IDataObject* pDataObj) 68 | { 69 | NotImplementFeature("OleSetClipboard"); 70 | return S_OK; 71 | } 72 | 73 | WINOLEAPI OleGetClipboard(IDataObject** ppDataObj) 74 | { 75 | NotImplementFeature("OleGetClipboard"); 76 | return S_OK; 77 | } 78 | 79 | WINOLEAPI OleFlushClipboard() 80 | { 81 | NotImplementFeature("OleFlushClipboard"); 82 | return S_OK; 83 | } 84 | 85 | WINOLEAPI OleIsCurrentClipboard(IDataObject* pDataObj) 86 | { 87 | NotImplementFeature("OleIsCurrentClipboard"); 88 | return S_OK; 89 | } 90 | 91 | // ------------------------------------------------------------------------- 92 | /* Drag/Drop APIs */ 93 | 94 | interface IDataObject; 95 | interface IDropSource; 96 | 97 | WINOLEAPI DoDragDrop( 98 | IDataObject* pDataObj, 99 | IDropSource* pDropSource, 100 | DWORD dwOKEffects, 101 | LPDWORD pdwEffect) 102 | { 103 | NotImplementFeature("DoDragDrop"); 104 | return S_OK; 105 | } 106 | 107 | // ========================================================================= 108 | // $Log: $ 109 | 110 | #endif /* STDEXT_WINAPI_OLE2_H */ 111 | -------------------------------------------------------------------------------- /include/stdext/winapi/oleauto.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/oleauto.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-26 0:45:33 16 | // 17 | // $Id: oleauto.h,v 1.1 2006/10/18 12:13:39 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_OLEAUTO_H 20 | #define STDEXT_WINAPI_OLEAUTO_H 21 | 22 | // ------------------------------------------------------------------------- 23 | 24 | // ------------------------------------------------------------------------- 25 | // $Log: oleauto.h,v $ 26 | // 27 | 28 | #endif /* STDEXT_WINAPI_OLEAUTO_H */ 29 | -------------------------------------------------------------------------------- /include/stdext/winapi/posix/time.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/posix/time.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-8-18 18:08:57 16 | // 17 | // $Id: time.h,v 1.6 2007/01/10 09:38:10 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_POSIX_TIME_H 20 | #define STDEXT_WINAPI_POSIX_TIME_H 21 | 22 | #ifndef STDEXT_WINAPI_WINDEF_H 23 | #include "../windef.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // int clock_getres(clockid_t clk_id, struct timespec *res); 28 | // int clock_gettime(clockid_t clk_id, struct timespec *tp); 29 | // int clock_settime(clockid_t clk_id, const struct timespec *tp); 30 | 31 | #ifndef _TIME_H 32 | #include 33 | #endif 34 | 35 | #ifndef _UNISTD_H 36 | #include 37 | #endif 38 | 39 | // See http://linux.die.net/man/3/clock_gettime 40 | // On POSIX systems on which these functions are available, the symbol _POSIX_TIMERS 41 | // is defined in to a value greater than 0. 42 | // The symbols _POSIX_MONOTONIC_CLOCK, _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME indicate 43 | // that CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID are available. 44 | #if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_MONOTONIC_CLOCK) 45 | #define STDEXT_HAS_MONOTONIC_CLOCK 46 | #endif 47 | 48 | // ------------------------------------------------------------------------- 49 | 50 | #if defined(STDEXT_HAS_MONOTONIC_CLOCK) 51 | 52 | __forceinline BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER* lp) 53 | { 54 | lp->QuadPart = 1000000000; 55 | return TRUE; 56 | } 57 | 58 | __forceinline BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER* lp) 59 | { 60 | struct timespec now; 61 | clock_gettime(CLOCK_MONOTONIC, &now); 62 | UINT64 ticks = (UINT64)now.tv_sec * 1000000000 + now.tv_nsec; 63 | lp->QuadPart = ticks; 64 | return TRUE; 65 | } 66 | 67 | __forceinline DWORD WINAPI GetTickCount() 68 | { 69 | struct timespec now; 70 | clock_gettime(CLOCK_MONOTONIC, &now); 71 | return (long)now.tv_sec * 1000 + (now.tv_nsec / 1000000); 72 | } 73 | 74 | #endif 75 | 76 | // ------------------------------------------------------------------------- 77 | 78 | __forceinline VOID WINAPI Sleep(DWORD dwMilliseconds) 79 | { 80 | /** The usleep() function suspends execution of the calling process for (at least) 81 | usec microseconds. The sleep may be lengthened slightly by any system activity 82 | or by the time spent processing the call or by the granularity of system timers. 83 | */ 84 | usleep(dwMilliseconds * 1000); 85 | } 86 | 87 | __forceinline VOID WINAPI SleepEx(DWORD dwMilliseconds, BOOL bAlertable) 88 | { 89 | usleep(dwMilliseconds * 1000); 90 | } 91 | 92 | // ------------------------------------------------------------------------- 93 | 94 | #endif /* STDEXT_WINAPI_POSIX_TIME_H */ 95 | -------------------------------------------------------------------------------- /include/stdext/winapi/shlwapi.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/shlwapi.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2003-10-5 13:20:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_SHLWAPI_H 20 | #define STDEXT_WINAPI_SHLWAPI_H 21 | 22 | #define LWSTDAPI inline HRESULT STDAPICALLTYPE 23 | #define LWSTDAPI_(type) inline type STDAPICALLTYPE 24 | 25 | // ========================================================================= 26 | 27 | LWSTDAPI_(LPSTR) PathFindExtensionA(LPCSTR pszPath) 28 | { 29 | NotImplementFeature("PathFindExtensionA"); 30 | return NULL; 31 | } 32 | 33 | // ========================================================================= 34 | 35 | LWSTDAPI SHCreateStreamOnFileA(LPCSTR pszFile, DWORD grfMode, struct IStream **ppstm) 36 | { 37 | NotImplementFeature("SHCreateStreamOnFileA"); 38 | return S_OK; 39 | } 40 | 41 | LWSTDAPI SHCreateStreamOnFileW(LPCWSTR pszFile, DWORD grfMode, struct IStream **ppstm) 42 | { 43 | NotImplementFeature("SHCreateStreamOnFileW"); 44 | return S_OK; 45 | } 46 | 47 | // ========================================================================= 48 | // $Log: $ 49 | 50 | #endif /* STDEXT_WINAPI_SHLWAPI_H */ 51 | -------------------------------------------------------------------------------- /include/stdext/winapi/winnls.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winapi/winnls.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2007-1-14 14:55:48 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINAPI_WINNLS_H 20 | #define STDEXT_WINAPI_WINNLS_H 21 | 22 | #ifndef STDEXT_WINAPI_WINBASE_H 23 | #include "winbase.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | // 28 | // Code Page Default Values. 29 | // 30 | #define CP_ACP 0 // default to ANSI code page 31 | #define CP_OEMCP 1 // default to OEM code page 32 | #define CP_MACCP 2 // default to MAC code page 33 | #define CP_THREAD_ACP 3 // current thread's ANSI code page 34 | #define CP_SYMBOL 42 // SYMBOL translations 35 | 36 | #define CP_UTF7 65000 // UTF-7 translation 37 | #define CP_UTF8 65001 // UTF-8 translation 38 | 39 | // ------------------------------------------------------------------------- 40 | 41 | inline int WINAPI MultiByteToWideChar( 42 | UINT CodePage, 43 | DWORD dwFlags, 44 | LPCSTR lpMultiByteStr, 45 | int cchMultiByte, 46 | LPWSTR lpWideCharStr, 47 | int cchWideChar) 48 | { 49 | NotImplementFeature("MultiByteToWideChar"); 50 | return 0; 51 | } 52 | 53 | inline int WINAPI WideCharToMultiByte( 54 | UINT CodePage, 55 | DWORD dwFlags, 56 | LPCWSTR lpWideCharStr, 57 | int cchWideChar, 58 | LPSTR lpMultiByteStr, 59 | int cchMultiByte, 60 | LPCSTR lpDefaultChar, 61 | LPBOOL lpUsedDefaultChar) 62 | { 63 | NotImplementFeature("WideCharToMultiByte"); 64 | return 0; 65 | } 66 | 67 | // ------------------------------------------------------------------------- 68 | // $Log: $ 69 | 70 | #endif /* STDEXT_WINAPI_WINNLS_H */ 71 | -------------------------------------------------------------------------------- /include/stdext/winsdk.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stdext/winsdk.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2007-1-14 15:24:12 16 | // 17 | // $Id: $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STDEXT_WINSDK_H 20 | #define STDEXT_WINSDK_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "../Platform.h" 24 | #endif 25 | 26 | // ------------------------------------------------------------------------- 27 | 28 | #if !defined(STD_NO_WINSDK) 29 | 30 | #ifndef __wtypes_h__ 31 | #include 32 | #endif 33 | 34 | #ifndef _OBJBASE_H_ 35 | #include // for CoTaskMemAlloc, CoTaskMemFree 36 | #endif 37 | 38 | #else 39 | 40 | #ifndef STDEXT_WINAPI_WTYPES_H 41 | #include "winapi/wtypes.h" 42 | #endif 43 | 44 | #ifndef STDEXT_WINAPI_OBJBASE_H 45 | #include "winapi/objbase.h" 46 | #endif 47 | 48 | #endif // defined(STD_NO_WINSDK) 49 | 50 | #if !defined(_W64) 51 | typedef signed char INT8, *PINT8; 52 | typedef signed short INT16, *PINT16; 53 | typedef unsigned char UINT8, *PUINT8; 54 | typedef unsigned short UINT16, *PUINT16; 55 | #endif 56 | 57 | // ------------------------------------------------------------------------- 58 | // StringFromGUID 59 | 60 | #ifndef STDEXT_MSVCRT_H 61 | #include "msvcrt.h" 62 | #endif 63 | 64 | inline LPSTR StringFromGUID(LPSTR idstr /* char[37] at least */, REFGUID guid) 65 | { 66 | static const char* hex = "0123456789ABCDEF"; 67 | char* s; 68 | int i; 69 | 70 | snprintf(idstr, 32, "%08lX-%04X-%04X-%02X%02X-", 71 | guid.Data1, guid.Data2, guid.Data3, 72 | guid.Data4[0], guid.Data4[1]); 73 | 74 | s = &idstr[24]; 75 | 76 | for (i = 2; i < 8; i++) { 77 | *s++ = hex[guid.Data4[i]>>4]; 78 | *s++ = hex[guid.Data4[i] & 0xf]; 79 | } 80 | 81 | *s = '\0'; 82 | return s; 83 | } 84 | 85 | #if defined(STD_NO_WINSDK) 86 | 87 | inline int StringFromGUID2(REFGUID guid, LPOLESTR lpsz, int cchMax) 88 | { 89 | if (cchMax < 39) 90 | return 0; 91 | 92 | char buf[40]; 93 | char* bufEnd = StringFromGUID(buf, guid); 94 | *lpsz++ = '{'; 95 | for (char* p = buf; p != bufEnd; ++p) 96 | *lpsz++ = *p; 97 | *lpsz++ = '}'; 98 | *lpsz = '\0'; 99 | return 39; 100 | } 101 | 102 | #endif 103 | 104 | // ------------------------------------------------------------------------- 105 | 106 | #endif /* STDEXT_WINSDK_H */ 107 | -------------------------------------------------------------------------------- /include/stlpatch.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------- 2 | // WINX: a C++ template GUI library - MOST SIMPLE BUT EFFECTIVE 3 | // 4 | // This file is a part of the WINX Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl.php) 7 | // which can be found in the file CPL.txt at this distribution. By using 8 | // this software in any fashion, you are agreeing to be bound by the terms 9 | // of this license. You must not remove this notice, or any other, from 10 | // this software. 11 | // 12 | // Module: stlpatch.h 13 | // Creator: xushiwei 14 | // Email: xushiweizh@gmail.com 15 | // Date: 2006-12-22 18:01:56 16 | // 17 | // $Id: stlpatch.h,v 1.1 2006/12/22 10:19:55 xushiwei Exp $ 18 | // -----------------------------------------------------------------------*/ 19 | #ifndef STLPATCH_H 20 | #define STLPATCH_H 21 | 22 | #ifndef STDEXT_PLATFORM_H 23 | #include "stdext/Platform.h" 24 | #endif 25 | 26 | #if !defined(_STDLIB_H) && !defined(_INC_STDLIB) 27 | #include 28 | #endif 29 | 30 | // ------------------------------------------------------------------------- 31 | 32 | #if defined(_MSC_VER) 33 | #pragma warning(disable:4786) 34 | #endif 35 | 36 | #ifndef STDEXT_PATCH_STRING_H 37 | #include "stdext/patch/string.h" 38 | #endif 39 | 40 | namespace std { 41 | 42 | // ------------------------------------------------------------------------- 43 | // iterToPointer - convert a vector/string iterator to pointer 44 | 45 | #if !defined(_MSC_VER) 46 | 47 | #ifndef __forceinline 48 | #define __forceinline inline 49 | #endif 50 | 51 | #endif 52 | 53 | #if defined(X_STL_NET) // visual c++ .net 54 | 55 | #if _MSC_VER < 1600 56 | 57 | template 58 | __forceinline typename _It::pointer iterToPointer(_It it) 59 | {return (typename _It::pointer)it._Myptr; } 60 | 61 | #else // _MSC_VER = 1600: visual c++ 2010 62 | 63 | template 64 | __forceinline typename _It::pointer iterToPointer(_It it) 65 | {return (typename _It::pointer)it._Ptr; } 66 | 67 | #endif 68 | 69 | template 70 | __forceinline _Ty* iterToPointer(_Ty* it) 71 | {return it;} 72 | 73 | template 74 | __forceinline const _Ty* iterToPointer(const _Ty* it) 75 | {return it;} 76 | 77 | #elif defined(X_STL_GCC) || defined(X_STL_SGI) // sgi-stl 78 | 79 | template 80 | __forceinline typename _It::pointer iterToPointer(_It it) 81 | {return &*it; } 82 | 83 | template 84 | __forceinline _Ty* iterToPointer(_Ty* it) 85 | {return it;} 86 | 87 | template 88 | __forceinline const _Ty* iterToPointer(const _Ty* it) 89 | {return it;} 90 | 91 | #else 92 | 93 | template 94 | __forceinline _It iterToPointer(_It it) 95 | {return it; } 96 | 97 | #endif 98 | 99 | #define _ConvIt iterToPointer 100 | 101 | // ------------------------------------------------------------------------- 102 | // resize 103 | 104 | template 105 | __forceinline 106 | typename _Container::value_type* resize(_Container& container, size_t newSize) 107 | {container.resize(newSize); 108 | return iterToPointer(container.begin()); } 109 | 110 | // ------------------------------------------------------------------------- 111 | // $Log: stlpatch.h,v $ 112 | 113 | } // namespace std 114 | 115 | #endif /* STLPATCH_H */ 116 | -------------------------------------------------------------------------------- /lib/shlwapi.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xushiwei/stdext/9a1e447d4a292585c749225562c6c18755e1c01d/lib/shlwapi.lib --------------------------------------------------------------------------------