├── .clang-format ├── .gitattributes ├── .gitignore ├── CHANGELOG ├── LICENSE ├── README.md ├── ROADMAP ├── build ├── azureci.yaml ├── foundation.sublime-project ├── msvc │ ├── build.default.props │ ├── foundation.sln │ ├── foundation.vcxproj │ ├── foundation.vcxproj.filters │ ├── test │ │ ├── all.vcxproj │ │ ├── app.vcxproj │ │ ├── array.vcxproj │ │ ├── atomic.vcxproj │ │ ├── base64.vcxproj │ │ ├── beacon.vcxproj │ │ ├── bitbuffer.vcxproj │ │ ├── blowfish.vcxproj │ │ ├── bufferstream.vcxproj │ │ ├── config.vcxproj │ │ ├── environment.vcxproj │ │ ├── error.vcxproj │ │ ├── event.vcxproj │ │ ├── exception.vcxproj │ │ ├── fs.vcxproj │ │ ├── hash.vcxproj │ │ ├── hashmap.vcxproj │ │ ├── hashtable.vcxproj │ │ ├── json.vcxproj │ │ ├── library.vcxproj │ │ ├── math.vcxproj │ │ ├── md5.vcxproj │ │ ├── mutex.vcxproj │ │ ├── objectmap.vcxproj │ │ ├── path.vcxproj │ │ ├── pipe.vcxproj │ │ ├── process.vcxproj │ │ ├── profile.vcxproj │ │ ├── radixsort.vcxproj │ │ ├── random.vcxproj │ │ ├── regex.vcxproj │ │ ├── ringbuffer.vcxproj │ │ ├── semaphore.vcxproj │ │ ├── sha.vcxproj │ │ ├── stacktrace.vcxproj │ │ ├── stream.vcxproj │ │ ├── string.vcxproj │ │ ├── system.vcxproj │ │ ├── test.vcxproj │ │ ├── time.vcxproj │ │ └── uuid.vcxproj │ └── tools │ │ ├── bin2hex.vcxproj │ │ ├── hashify.vcxproj │ │ └── uuidgen.vcxproj ├── ninja.nuspec ├── ninja │ ├── android.py │ ├── clang.py │ ├── codesign.py │ ├── gcc.py │ ├── generator.py │ ├── msvc.py │ ├── platform.py │ ├── plist.py │ ├── syntax.py │ ├── toolchain.py │ ├── version.py │ ├── vslocate.py │ └── xcode.py └── xcode │ ├── foundation-ios.xcworkspace │ └── contents.xcworkspacedata │ ├── foundation-osx.xcworkspace │ └── contents.xcworkspacedata │ ├── ios │ ├── foundation.xcodeproj │ │ └── project.pbxproj │ └── test.xcodeproj │ │ └── project.pbxproj │ └── osx │ ├── foundation.xcodeproj │ └── project.pbxproj │ ├── test.xcodeproj │ └── project.pbxproj │ └── tool.xcodeproj │ └── project.pbxproj ├── config └── foundation.json ├── configure.py ├── doc ├── Doxyfile └── mainpage.dox ├── example ├── build │ ├── ninja │ │ ├── android.py │ │ ├── clang.py │ │ ├── codesign.py │ │ ├── gcc.py │ │ ├── generator.py │ │ ├── msvc.py │ │ ├── platform.py │ │ ├── plist.py │ │ ├── syntax.py │ │ ├── toolchain.py │ │ ├── version.py │ │ ├── vslocate.py │ │ └── xcode.py │ └── vs15 │ │ ├── example.sln │ │ ├── example.vcxproj │ │ └── example.vcxproj.filters ├── config │ └── example.json ├── configure.py └── example │ └── main.c ├── foundation ├── android.c ├── android.h ├── apple.h ├── array.c ├── array.h ├── assert.c ├── assert.h ├── assetstream.c ├── assetstream.h ├── atomic.c ├── atomic.h ├── base64.c ├── base64.h ├── beacon.c ├── beacon.h ├── bitbuffer.c ├── bitbuffer.h ├── bits.h ├── blowfish.c ├── blowfish.h ├── bucketarray.c ├── bucketarray.h ├── bufferstream.c ├── bufferstream.h ├── build.h ├── delegate.h ├── delegate.m ├── environment.c ├── environment.h ├── environment.m ├── error.c ├── error.h ├── event.c ├── event.h ├── exception.c ├── exception.h ├── foundation.c ├── foundation.h ├── fs.c ├── fs.h ├── fs.m ├── hash.c ├── hash.h ├── hashmap.c ├── hashmap.h ├── hashstrings.h ├── hashstrings.txt ├── hashtable.c ├── hashtable.h ├── internal.h ├── json.c ├── json.h ├── library.c ├── library.h ├── locale.h ├── log.c ├── log.h ├── main.c ├── main.h ├── math.h ├── md5.c ├── md5.h ├── memory.c ├── memory.h ├── mutex.c ├── mutex.h ├── objectmap.c ├── objectmap.h ├── path.c ├── path.h ├── pipe.c ├── pipe.h ├── platform.h ├── posix.h ├── process.c ├── process.h ├── profile.c ├── profile.h ├── radixsort.c ├── radixsort.h ├── random.c ├── random.h ├── regex.c ├── regex.h ├── ringbuffer.c ├── ringbuffer.h ├── semaphore.c ├── semaphore.h ├── sha.c ├── sha.h ├── stacktrace.c ├── stacktrace.h ├── stream.c ├── stream.h ├── string.c ├── string.h ├── system.c ├── system.h ├── system.m ├── thread.c ├── thread.h ├── time.c ├── time.h ├── tizen.c ├── tizen.h ├── types.h ├── uuid.c ├── uuid.h ├── uuidmap.c ├── uuidmap.h ├── version.h ├── virtualarray.c ├── virtualarray.h └── windows.h ├── options.lnt ├── test ├── all │ ├── android │ │ ├── AndroidManifest.xml │ │ ├── drawable-hdpi │ │ │ └── icon.png │ │ ├── drawable-ldpi │ │ │ └── icon.png │ │ ├── drawable-mdpi │ │ │ └── icon.png │ │ ├── drawable-xhdpi │ │ │ └── icon.png │ │ ├── drawable-xxhdpi │ │ │ └── icon.png │ │ ├── drawable-xxxhdpi │ │ │ └── icon.png │ │ ├── java │ │ │ └── com │ │ │ │ └── maniccoder │ │ │ │ └── foundation │ │ │ │ └── test │ │ │ │ └── TestActivity.java │ │ ├── layout │ │ │ └── main.xml │ │ └── values │ │ │ └── strings.xml │ ├── ios │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon_100.png │ │ │ │ ├── icon_114.png │ │ │ │ ├── icon_120.png │ │ │ │ ├── icon_144.png │ │ │ │ ├── icon_152.png │ │ │ │ ├── icon_180.png │ │ │ │ ├── icon_29-1.png │ │ │ │ ├── icon_29.png │ │ │ │ ├── icon_40.png │ │ │ │ ├── icon_50.png │ │ │ │ ├── icon_57.png │ │ │ │ ├── icon_58-1.png │ │ │ │ ├── icon_58.png │ │ │ │ ├── icon_72.png │ │ │ │ ├── icon_76.png │ │ │ │ ├── icon_80-1.png │ │ │ │ └── icon_80.png │ │ │ └── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── launch_1024_748.png │ │ │ │ ├── launch_1024_768.png │ │ │ │ ├── launch_1536_2008.png │ │ │ │ ├── launch_1536_2048.png │ │ │ │ ├── launch_2048_1496.png │ │ │ │ ├── launch_2048_1536.png │ │ │ │ ├── launch_320_480.png │ │ │ │ ├── launch_640_1136.png │ │ │ │ ├── launch_640_960.png │ │ │ │ ├── launch_768_1004.png │ │ │ │ └── launch_768_1024.png │ │ ├── test-all.plist │ │ ├── test-all.xib │ │ ├── viewcontroller.h │ │ └── viewcontroller.m │ ├── main.c │ └── tizen │ │ ├── res │ │ └── tizenapp.png │ │ └── tizen-manifest.xml ├── app │ └── main.c ├── array │ └── main.c ├── atomic │ └── main.c ├── base64 │ └── main.c ├── beacon │ └── main.c ├── bitbuffer │ └── main.c ├── blowfish │ └── main.c ├── bufferstream │ └── main.c ├── codecov.py ├── coverage.py ├── environment │ └── main.c ├── error │ └── main.c ├── event │ └── main.c ├── exception │ └── main.c ├── fs │ └── main.c ├── hash │ └── main.c ├── hashmap │ └── main.c ├── hashtable │ └── main.c ├── json │ └── main.c ├── library │ └── main.c ├── math │ └── main.c ├── md5 │ └── main.c ├── mock │ ├── mock.c │ └── mock.h ├── mutex │ └── main.c ├── objectmap │ └── main.c ├── path │ └── main.c ├── pipe │ └── main.c ├── process │ └── main.c ├── profile │ └── main.c ├── radixsort │ └── main.c ├── random │ └── main.c ├── regex │ └── main.c ├── ringbuffer │ └── main.c ├── semaphore │ └── main.c ├── sha │ └── main.c ├── stacktrace │ └── main.c ├── stream │ └── main.c ├── string │ └── main.c ├── system │ └── main.c ├── test │ ├── test.c │ ├── test.h │ └── test.m ├── time │ └── main.c └── uuid │ └── main.c └── tools ├── bin2hex ├── errorcodes.h └── main.c ├── hashify ├── errorcodes.h └── main.c └── uuidgen ├── errorcodes.h └── main.c /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AlignAfterOpenBracket: Align 3 | AlignConsecutiveAssignments: 'false' 4 | AlignConsecutiveDeclarations: 'false' 5 | AlignOperands: 'true' 6 | AlignTrailingComments: 'true' 7 | AllowAllParametersOfDeclarationOnNextLine: 'false' 8 | AllowShortBlocksOnASingleLine: 'false' 9 | AllowShortCaseLabelsOnASingleLine: 'false' 10 | AllowShortFunctionsOnASingleLine: None 11 | AllowShortIfStatementsOnASingleLine: 'false' 12 | AllowShortLoopsOnASingleLine: 'false' 13 | AlwaysBreakAfterDefinitionReturnType: TopLevel 14 | AlwaysBreakAfterReturnType: TopLevel 15 | AlwaysBreakBeforeMultilineStrings: 'true' 16 | AlwaysBreakTemplateDeclarations: 'true' 17 | BinPackArguments: 'true' 18 | BinPackParameters: 'true' 19 | BreakBeforeBinaryOperators: None 20 | BreakBeforeBraces: Attach 21 | BreakBeforeTernaryOperators: 'false' 22 | ColumnLimit: '120' 23 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' 24 | DerivePointerAlignment: 'false' 25 | ExperimentalAutoDetectBinPacking: 'false' 26 | IndentCaseLabels: 'true' 27 | IndentWidth: '4' 28 | IndentWrappedFunctionNames: 'false' 29 | KeepEmptyLinesAtTheStartOfBlocks: 'false' 30 | MaxEmptyLinesToKeep: '1' 31 | NamespaceIndentation: None 32 | ObjCSpaceAfterProperty: 'true' 33 | ObjCSpaceBeforeProtocolList: 'true' 34 | PointerAlignment: Left 35 | SortIncludes: 'false' 36 | SpaceAfterCStyleCast: 'false' 37 | SpaceAfterTemplateKeyword: 'true' 38 | SpaceBeforeAssignmentOperators: 'true' 39 | SpaceBeforeParens: ControlStatements 40 | SpaceInEmptyParentheses: 'false' 41 | SpacesInAngles: 'false' 42 | SpacesInCStyleCastParentheses: 'false' 43 | SpacesInContainerLiterals: 'false' 44 | SpacesInParentheses: 'false' 45 | SpacesInSquareBrackets: 'false' 46 | TabWidth: '4' 47 | UseTab: ForIndentation 48 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Never mangle resource blob files 5 | *.blob -text 6 | 7 | # Custom for Visual Studio 8 | *.cs diff=csharp 9 | *.sln merge=union 10 | *.csproj merge=union 11 | *.vbproj merge=union 12 | *.fsproj merge=union 13 | *.dbproj merge=union 14 | 15 | # Standard to msysgit 16 | *.doc diff=astextplain 17 | *.DOC diff=astextplain 18 | *.docx diff=astextplain 19 | *.DOCX diff=astextplain 20 | *.dot diff=astextplain 21 | *.DOT diff=astextplain 22 | *.pdf diff=astextplain 23 | *.PDF diff=astextplain 24 | *.rtf diff=astextplain 25 | *.RTF diff=astextplain 26 | 27 | # Ignore build scripts in language stats 28 | build/* linguist-vendored 29 | configure.py linguist-vendored=true 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Foundation Library - Public Domain 2 | 3 | This library provides a cross-platform foundation library in C providing basic support data types and 4 | functions to write applications and games in a platform-independent fashion. It provides: 5 | 6 | * Abstractions and unification of basic data types 7 | * Pluggable memory management 8 | * Threads and synchronization 9 | * Atomic operations 10 | * Timing and profiling 11 | * Object lifetime management 12 | * Events processing 13 | * File system access 14 | * Dynamic library loading 15 | * Process spawning 16 | * Logging, error reporting and asserts 17 | * String handling in UTF-8 and UTF-16 18 | * Murmur hasing and statically hashed strings 19 | * Math support for 32 and 64 bit floats 20 | * JSON/SJSON parser 21 | * SHA256/SHA512 digest 22 | * Application, environment and system queries and control 23 | * Regular expressions 24 | * Exception utilities (SEH, signals) 25 | 26 | It is written with the following API design principles in mind: 27 | 28 | * Consistent. All functions, parameters and types should follow a well defined pattern in order to make it easy to remember how function names are constructed and how to pass the expected parameters. 29 | * Orthogonal. A function should not have any side effects, and there should be only one way to perform an operation in the system. 30 | * Specialized. A function in an API should perform a single task. Functions should not do completely different unrelated tasks or change behaviour depending on the contents of the variables passed in. 31 | * Compact. The API needs to be compact, meaning the user can use it without using a manual. Note though that "compact" does not mean "small". A consistent naming scheme makes the API easier to use and remember. 32 | * Contained. Third party dependencies are kept to an absolute minimum and prefer to use primitive or well-defined data types. 33 | 34 | Platforms and architectures currently supported: 35 | 36 | * Windows (x86, x86-64), Vista or later 37 | * MacOS X (x86-64), 10.7+ 38 | * Linux (x86, x86-64, PPC, ARM) 39 | * FreeBSD (x86, x86-64, PPC, ARM) 40 | * iOS (ARMv7, ARMv7s, ARMv8/AArch64), 6.0+ 41 | * Android (ARMv6, ARMv7, ARMv8/AArch64, x86, x86-64, MIPS, MIPS64) 42 | * Raspberry Pi (ARMv6) 43 | 44 | Discord server for discussions 45 | https://discord.gg/M8BwTQrt6c 46 | 47 | The latest source code maintained by Mattias Jansson is always available at 48 | 49 | 50 | Main branch is used for development. Releases are tags on main branch. 51 | 52 | 53 | Cross-platform build system uses Ninja 54 | 55 | 56 | This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. 57 | 58 | 59 | Created by Mattias Jansson ([@maniccoder](https://twitter.com/maniccoder)) 60 | -------------------------------------------------------------------------------- /ROADMAP: -------------------------------------------------------------------------------- 1 | 1.7.0 2 | 3 | Nothing planned, suggestions can be added as issues in the foundation library github @ https://github.com/mjansson/foundation_lib 4 | -------------------------------------------------------------------------------- /build/foundation.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "follow_symlinks": true, 6 | "path": "../foundation" 7 | }, 8 | { 9 | "follow_symlinks": true, 10 | "path": "../test" 11 | }, 12 | { 13 | "follow_symlinks": true, 14 | "path": "../tools" 15 | }, 16 | { 17 | "follow_symlinks": true, 18 | "path": "../doc" 19 | } 20 | ], 21 | "build_systems": 22 | [ 23 | { 24 | "name": "Ninja", 25 | "shell_cmd": "ninja", 26 | "working_dir": "${project_path:${folder:${file_path}}}/..", 27 | "file_regex": "^(.+):([0-9]+):([0-9]+):(.+)$" 28 | } 29 | ], 30 | "use_tab_stops": true, 31 | "translate_tabs_to_spaces": false, 32 | "trim_trailing_white_space_on_save": true, 33 | "settings": 34 | { 35 | "AStyleFormatter": 36 | { 37 | "options_default": 38 | { 39 | "style" : "attach", 40 | "pad-oper": false, 41 | "pad-header": true, 42 | "indent-switches" : false, 43 | "indent-cases" : true, 44 | "unpad-paren": true, 45 | "break-closing-brackets": true, 46 | "align-pointer": "type", 47 | "max-code-length": 100, 48 | "max-instatement-indent": 60, 49 | "break-after-logical": true 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /build/msvc/test/all.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {9BE10365-AB0A-43E0-917E-F6A229F650A2} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/app.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {1382CDCF-0573-4E6A-80DC-68519C89C7B3} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/array.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {1FD83891-E467-45D6-82D2-3B25C441BD49} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/atomic.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {70D39DC5-72C4-4794-9024-214C6454CCC5} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/base64.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {F4A4B87B-6F4C-4615-A8A7-FEACBC214292} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/beacon.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {24238EAD-0D2C-4C8C-8505-C39A9C4A21B6} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/bitbuffer.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {3E467006-26A5-430C-AE3B-F6D820FF5153} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/blowfish.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {E079ED2B-5A44-4BA8-A920-F9238AE2A5D9} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/bufferstream.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {AA0A39F9-F3B4-45C5-B06F-13B3A0B65E6B} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/config.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | test-$(ProjectName) 20 | 21 | 22 | 23 | 24 | 25 | 26 | {6abde628-e9d5-4a7f-9847-a47f56210273} 27 | 28 | 29 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 30 | 31 | 32 | 33 | 34 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 35 | 36 | 37 | Console 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /build/msvc/test/environment.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {28727FF9-3DFC-4477-8882-81C1B853A0FA} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/error.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {A18CDE49-0131-4C53-94AD-1784CBDBDF4D} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/event.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {E533C5C7-1527-4C00-825A-2553FBEE17FB} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/exception.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {D5954A7B-6511-41A3-83C3-DA13E32594C5} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/fs.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {3A33831A-C365-425A-9BE6-552AF23828DE} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/hash.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {4A43D742-5F94-431D-8F7C-5456ACBD1F8D} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/hashmap.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {CCBB70E7-638C-4486-BB60-6427162BBF58} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/hashtable.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {ADECD2E4-29F9-4283-8A45-AC406B648755} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/json.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {E413A5D6-5F4F-4B42-85E4-A9F84F3D15A0} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/library.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {03FA12D5-BD8E-4DF8-BD89-5EF0EF0AB957} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/math.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {089A4EF2-1E55-4D71-9FCB-0DF652E641F3} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/md5.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {9E5ADDC8-701A-488E-A425-B0650C97089A} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/mutex.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {C96F1166-6361-4734-B947-8E5906AA1831} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/objectmap.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {03D2CDF6-72BF-4BE1-9E6D-70B45199394C} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/path.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {888F7AF6-9FB1-4051-B58D-89C2C90FA4DA} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/pipe.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {15984085-04FC-403A-9AB7-CB7CDC18B3FF} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/process.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {0EF545EE-0B13-4F1E-BEC7-E412319E88A7} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/profile.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {60B90F17-8A2B-48DE-A846-C4AF3876D3BB} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/radixsort.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {CD2255BC-EAE1-4E4E-B1D1-E16F3B9E1C00} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/random.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {2EF76AD3-347A-4263-824E-C96645ADDE22} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/regex.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {E3B8AE6F-3871-4DCE-BB18-1315EECE978A} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/ringbuffer.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {08D9AA1A-5AE9-4D58-9C89-B9094B431253} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/semaphore.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {3B42F64D-7CCE-4959-B4B9-F0E454CD58FD} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/sha.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {8FDE552D-8F9B-4A81-9500-BAADDDF7507F} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/stacktrace.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {5CDEA389-BC8B-4379-81EE-85CFF7351195} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/stream.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {4BD0356A-DB84-40EE-AD10-DB0F41E5F122} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/string.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {FA315CA2-10FE-49E5-8865-1D7230FEDFBF} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/system.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {8C4784CA-8C96-4380-9A86-96C70E516300} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | StaticLibrary 8 | {B2D31D20-6812-4040-9DDB-B0B03E852672} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | $(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 31 | 32 | 33 | Console 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /build/msvc/test/time.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {93E29F6D-7E60-4333-A40A-1160CFBEF3AA} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/test/uuid.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {AAE75B92-8A2C-4190-A6B5-90DDA4042C7F} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | test-$(ProjectName) 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | {b2d31d20-6812-4040-9ddb-b0b03e852672} 31 | 32 | 33 | 34 | 35 | $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\test;%(AdditionalIncludeDirectories) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/msvc/tools/bin2hex.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {99CA9F8C-B24B-4A37-9FCD-0BE1E30A0BEA} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | 31 | 32 | $(ProjectDir)..\..\..;%(AdditionalIncludeDirectories) 33 | 34 | 35 | Console 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /build/msvc/tools/hashify.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {EF2E62BC-67B3-4A13-BDCD-1112C1D15755} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | 31 | 32 | $(ProjectDir)..\..\..;%(AdditionalIncludeDirectories) 33 | 34 | 35 | Console 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /build/msvc/tools/uuidgen.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Win32Proj 5 | foundation 6 | 10.0 7 | Application 8 | {BD0E6B9E-383B-4764-9F84-F3C370ECD211} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {6abde628-e9d5-4a7f-9847-a47f56210273} 28 | 29 | 30 | 31 | 32 | $(ProjectDir)..\..\..;%(AdditionalIncludeDirectories) 33 | 34 | 35 | Console 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /build/ninja.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ninja 5 | 1.8.2.1 6 | Ninja Build 7 | ninja-build.org 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /build/ninja/platform.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | """Ninja platform abstraction""" 4 | 5 | import sys 6 | 7 | def supported_platforms(): 8 | return [ 'windows', 'linux', 'macos', 'bsd', 'ios', 'android', 'raspberrypi', 'tizen', 'sunos', 'haiku' ] 9 | 10 | class Platform(object): 11 | def __init__(self, platform): 12 | self.platform = platform 13 | if self.platform is None: 14 | self.platform = sys.platform 15 | if self.platform.startswith('linux'): 16 | self.platform = 'linux' 17 | elif self.platform.startswith('darwin'): 18 | self.platform = 'macos' 19 | elif self.platform.startswith('macos'): 20 | self.platform = 'macos' 21 | elif self.platform.startswith('win'): 22 | self.platform = 'windows' 23 | elif 'bsd' in self.platform or self.platform.startswith('dragonfly'): 24 | self.platform = 'bsd' 25 | elif self.platform.startswith('ios'): 26 | self.platform = 'ios' 27 | elif self.platform.startswith('android'): 28 | self.platform = 'android' 29 | elif self.platform.startswith('raspberry'): 30 | self.platform = 'raspberrypi' 31 | elif self.platform.startswith('tizen'): 32 | self.platform = 'tizen' 33 | elif self.platform.startswith('sunos'): 34 | self.platform = 'sunos' 35 | elif self.platform.startswith('haiku'): 36 | self.platform = 'haiku' 37 | 38 | def platform(self): 39 | return self.platform 40 | 41 | def is_linux(self): 42 | return self.platform == 'linux' 43 | 44 | def is_windows(self): 45 | return self.platform == 'windows' 46 | 47 | def is_macos(self): 48 | return self.platform == 'macos' 49 | 50 | def is_bsd(self): 51 | return self.platform == 'bsd' 52 | 53 | def is_ios(self): 54 | return self.platform == 'ios' 55 | 56 | def is_android(self): 57 | return self.platform == 'android' 58 | 59 | def is_raspberrypi(self): 60 | return self.platform == 'raspberrypi' 61 | 62 | def is_tizen(self): 63 | return self.platform == 'tizen' 64 | 65 | def is_sunos(self): 66 | return self.platform == 'sunos' 67 | 68 | def is_haiku(self): 69 | return self.platform == 'haiku' 70 | 71 | def get(self): 72 | return self.platform 73 | -------------------------------------------------------------------------------- /build/ninja/version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Version utility""" 4 | 5 | import subprocess 6 | import os 7 | import sys 8 | 9 | def generate_version_string(libname): 10 | 11 | version_numbers = [] 12 | tokens = [] 13 | 14 | gitcmd = 'git' 15 | if sys.platform.startswith('win'): 16 | gitcmd = 'git.exe' 17 | try: 18 | git_version = subprocess.check_output( [ gitcmd, 'describe', '--tags', '--long' ], stderr = subprocess.STDOUT ).strip() 19 | tokens = git_version.decode().split( '-' ) 20 | version_numbers = tokens[0].split( '.' ) 21 | except Exception: 22 | pass 23 | 24 | version_major = "0" 25 | version_minor = "0" 26 | version_revision = "1" 27 | version_build = "0" 28 | version_scm = "0" 29 | 30 | if version_numbers and len( version_numbers ) > 2: 31 | version_major = version_numbers[0] 32 | version_minor = version_numbers[1] 33 | version_revision = version_numbers[2] 34 | 35 | if tokens and len( tokens ) > 2: 36 | version_build = tokens[1] 37 | version_scm = tokens[2][1:] 38 | 39 | module = "" 40 | if not libname == "foundation": 41 | module = "_module" 42 | 43 | source = """/* ****** AUTOMATICALLY GENERATED, DO NOT EDIT ****** 44 | This file is generated from the git describe command. 45 | Run the configure script to regenerate this file */ 46 | 47 | #include 48 | #include <""" + libname + "/" + libname + """.h> 49 | 50 | version_t 51 | """ + libname + module + """_version(void) { 52 | """ 53 | source += " return version_make(" + version_major + ", " + version_minor + ", " + version_revision + ", " + version_build + ", 0x" + version_scm + ");\n}\n" 54 | return source 55 | 56 | def read_version_string(input_path): 57 | try: 58 | file = open( os.path.join( input_path, 'version.c' ), "r" ) 59 | str = file.read() 60 | file.close() 61 | except IOError: 62 | str = "" 63 | return str 64 | 65 | def write_version_string(output_path, str): 66 | file = open( os.path.join( output_path, 'version.c' ), "w" ) 67 | file.write( str ) 68 | file.close 69 | 70 | def generate_version(libname, output_path): 71 | generated = generate_version_string(libname) 72 | if generated == None: 73 | return 74 | previous = read_version_string(output_path) 75 | 76 | if generated != previous: 77 | write_version_string(output_path, generated) 78 | 79 | if __name__ == "__main__": 80 | generate_version(sys.argv[1], sys.argv[2]) 81 | -------------------------------------------------------------------------------- /build/xcode/foundation-ios.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/xcode/foundation-osx.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /config/foundation.json: -------------------------------------------------------------------------------- 1 | { 2 | "foundation" : { 3 | "temporary_memory": 0, 4 | "memory_tracker": "local" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/build/ninja/platform.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | """Ninja platform abstraction""" 4 | 5 | import sys 6 | 7 | def supported_platforms(): 8 | return [ 'windows', 'linux', 'macos', 'bsd', 'ios', 'android', 'raspberrypi', 'tizen', 'sunos', 'haiku' ] 9 | 10 | class Platform(object): 11 | def __init__(self, platform): 12 | self.platform = platform 13 | if self.platform is None: 14 | self.platform = sys.platform 15 | if self.platform.startswith('linux'): 16 | self.platform = 'linux' 17 | elif self.platform.startswith('darwin'): 18 | self.platform = 'macos' 19 | elif self.platform.startswith('macos'): 20 | self.platform = 'macos' 21 | elif self.platform.startswith('win'): 22 | self.platform = 'windows' 23 | elif 'bsd' in self.platform or self.platform.startswith('dragonfly'): 24 | self.platform = 'bsd' 25 | elif self.platform.startswith('ios'): 26 | self.platform = 'ios' 27 | elif self.platform.startswith('android'): 28 | self.platform = 'android' 29 | elif self.platform.startswith('raspberry'): 30 | self.platform = 'raspberrypi' 31 | elif self.platform.startswith('tizen'): 32 | self.platform = 'tizen' 33 | elif self.platform.startswith('sunos'): 34 | self.platform = 'sunos' 35 | elif self.platform.startswith('haiku'): 36 | self.platform = 'haiku' 37 | 38 | def platform(self): 39 | return self.platform 40 | 41 | def is_linux(self): 42 | return self.platform == 'linux' 43 | 44 | def is_windows(self): 45 | return self.platform == 'windows' 46 | 47 | def is_macos(self): 48 | return self.platform == 'macos' 49 | 50 | def is_bsd(self): 51 | return self.platform == 'bsd' 52 | 53 | def is_ios(self): 54 | return self.platform == 'ios' 55 | 56 | def is_android(self): 57 | return self.platform == 'android' 58 | 59 | def is_raspberrypi(self): 60 | return self.platform == 'raspberrypi' 61 | 62 | def is_tizen(self): 63 | return self.platform == 'tizen' 64 | 65 | def is_sunos(self): 66 | return self.platform == 'sunos' 67 | 68 | def is_haiku(self): 69 | return self.platform == 'haiku' 70 | 71 | def get(self): 72 | return self.platform 73 | -------------------------------------------------------------------------------- /example/build/ninja/version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Version utility""" 4 | 5 | import subprocess 6 | import os 7 | import sys 8 | 9 | def generate_version_string(libname): 10 | 11 | version_numbers = [] 12 | tokens = [] 13 | 14 | gitcmd = 'git' 15 | if sys.platform.startswith('win'): 16 | gitcmd = 'git.exe' 17 | try: 18 | git_version = subprocess.check_output( [ gitcmd, 'describe', '--tags', '--long' ], stderr = subprocess.STDOUT ).strip() 19 | tokens = git_version.decode().split( '-' ) 20 | version_numbers = tokens[0].split( '.' ) 21 | except Exception: 22 | pass 23 | 24 | version_major = "0" 25 | version_minor = "0" 26 | version_revision = "1" 27 | version_build = "0" 28 | version_scm = "0" 29 | 30 | if version_numbers and len( version_numbers ) > 2: 31 | version_major = version_numbers[0] 32 | version_minor = version_numbers[1] 33 | version_revision = version_numbers[2] 34 | 35 | if tokens and len( tokens ) > 2: 36 | version_build = tokens[1] 37 | version_scm = tokens[2][1:] 38 | 39 | module = "" 40 | if not libname == "foundation": 41 | module = "_module" 42 | 43 | source = """/* ****** AUTOMATICALLY GENERATED, DO NOT EDIT ****** 44 | This file is generated from the git describe command. 45 | Run the configure script to regenerate this file */ 46 | 47 | #include 48 | #include <""" + libname + "/" + libname + """.h> 49 | 50 | version_t 51 | """ + libname + module + """_version(void) { 52 | """ 53 | source += " return version_make(" + version_major + ", " + version_minor + ", " + version_revision + ", " + version_build + ", 0x" + version_scm + ");\n}\n" 54 | return source 55 | 56 | def read_version_string(input_path): 57 | try: 58 | file = open( os.path.join( input_path, 'version.c' ), "r" ) 59 | str = file.read() 60 | file.close() 61 | except IOError: 62 | str = "" 63 | return str 64 | 65 | def write_version_string(output_path, str): 66 | file = open( os.path.join( output_path, 'version.c' ), "w" ) 67 | file.write( str ) 68 | file.close 69 | 70 | def generate_version(libname, output_path): 71 | generated = generate_version_string(libname) 72 | if generated == None: 73 | return 74 | previous = read_version_string(output_path) 75 | 76 | if generated != previous: 77 | write_version_string(output_path, generated) 78 | 79 | if __name__ == "__main__": 80 | generate_version(sys.argv[1], sys.argv[2]) 81 | -------------------------------------------------------------------------------- /example/build/vs15/example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{F78411DA-67A4-493E-89A1-920CFC088429}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Deploy|x64 = Deploy|x64 13 | Deploy|x86 = Deploy|x86 14 | Profile|x64 = Profile|x64 15 | Profile|x86 = Profile|x86 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {F78411DA-67A4-493E-89A1-920CFC088429}.Debug|x64.ActiveCfg = Debug|x64 21 | {F78411DA-67A4-493E-89A1-920CFC088429}.Debug|x64.Build.0 = Debug|x64 22 | {F78411DA-67A4-493E-89A1-920CFC088429}.Debug|x86.ActiveCfg = Debug|Win32 23 | {F78411DA-67A4-493E-89A1-920CFC088429}.Debug|x86.Build.0 = Debug|Win32 24 | {F78411DA-67A4-493E-89A1-920CFC088429}.Deploy|x64.ActiveCfg = Deploy|x64 25 | {F78411DA-67A4-493E-89A1-920CFC088429}.Deploy|x64.Build.0 = Deploy|x64 26 | {F78411DA-67A4-493E-89A1-920CFC088429}.Deploy|x86.ActiveCfg = Deploy|Win32 27 | {F78411DA-67A4-493E-89A1-920CFC088429}.Deploy|x86.Build.0 = Deploy|Win32 28 | {F78411DA-67A4-493E-89A1-920CFC088429}.Profile|x64.ActiveCfg = Profile|x64 29 | {F78411DA-67A4-493E-89A1-920CFC088429}.Profile|x64.Build.0 = Profile|x64 30 | {F78411DA-67A4-493E-89A1-920CFC088429}.Profile|x86.ActiveCfg = Profile|Win32 31 | {F78411DA-67A4-493E-89A1-920CFC088429}.Profile|x86.Build.0 = Profile|Win32 32 | {F78411DA-67A4-493E-89A1-920CFC088429}.Release|x64.ActiveCfg = Release|x64 33 | {F78411DA-67A4-493E-89A1-920CFC088429}.Release|x64.Build.0 = Release|x64 34 | {F78411DA-67A4-493E-89A1-920CFC088429}.Release|x86.ActiveCfg = Release|Win32 35 | {F78411DA-67A4-493E-89A1-920CFC088429}.Release|x86.Build.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /example/build/vs15/example.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/config/example.json: -------------------------------------------------------------------------------- 1 | example_variable = "some string" 2 | example_object = { 3 | sub_variable = 1234.56 4 | } 5 | -------------------------------------------------------------------------------- /example/configure.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Ninja build configurator for foundation library example program""" 4 | 5 | import sys 6 | import os 7 | 8 | sys.path.insert(0, os.path.join('build', 'ninja')) 9 | 10 | import generator 11 | 12 | project = 'example' 13 | 14 | sources = ['main.c'] 15 | 16 | libs = ['foundation'] 17 | 18 | includepaths = ['..'] # For foundation library 19 | libpaths = ['..'] # For foundation library 20 | 21 | generator = generator.Generator(project = project, variables = [('bundleidentifier', 'com.maniccoder.foundation.$(binname)')]) 22 | 23 | if generator.target.is_macosx() or generator.target.is_ios() or generator.target.is_android() or generator.target.is_tizen(): 24 | resources = [] 25 | extrasources = [] 26 | if generator.target.is_ios(): 27 | resources = [os.path.join('ios', item) for item in [ 28 | 'example.plist', 'Images.xcassets', 'example.xib' 29 | ]] 30 | extrasources = [os.path.join('ios', item) for item in [ 31 | 'viewcontroller.m' 32 | ]] 33 | elif generator.target.is_android(): 34 | resources = [os.path.join('android', item) for item in [ 35 | 'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'), 36 | os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'), 37 | os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png') 38 | ]] 39 | extrasources = [os.path.join('android', 'java', 'com', 'maniccoder', 'foundation', 'example', item) for item in [ 40 | 'ExampleActivity.java' 41 | ]] 42 | elif generator.target.is_tizen(): 43 | resources = [os.path.join('tizen', item) for item in [ 44 | 'tizen-manifest.xml', os.path.join('res', 'tizenapp.png') 45 | ]] 46 | generator.app(module = project, sources = sources + extrasources, binname = project, libs = libs, resources = resources, includepaths = includepaths, libpaths = libpaths) 47 | else: 48 | generator.bin(module = project, sources = sources, binname = project, libs = libs, includepaths = includepaths, libpaths = libpaths) 49 | -------------------------------------------------------------------------------- /foundation/apple.h: -------------------------------------------------------------------------------- 1 | /* apple.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file apple.h 16 | \brief Apple system header includes 17 | 18 | Safe inclusion of mach and Apple headers for both OSX and iOS targets. Use this header 19 | instead of direct inclusion of mach/Apple headers to avoid compilation problems with 20 | multiple or missing definitions. 21 | 22 | \internal NOTE - The base of all header problems with XCode is that 23 | #include in system headers will actually map 24 | to our foundation/foundation.h \endinternal */ 25 | 26 | // We need to pull in all foundation headers here to make sure everything is included 27 | // before overriding types, in case the system framework includes maps back to 28 | // our headers. 29 | #include 30 | 31 | #if FOUNDATION_PLATFORM_APPLE 32 | 33 | #if FOUNDATION_COMPILER_CLANG 34 | #pragma clang diagnostic push 35 | #pragma clang diagnostic ignored "-Wpedantic" 36 | #pragma clang diagnostic ignored "-Wreserved-id-macro" 37 | #endif 38 | 39 | #define __error_t_defined 1 40 | 41 | #define semaphore_t __system_semaphore_t 42 | #define _UUID_T 43 | #define uuid_generate_random __system_uuid_generate_random 44 | #define uuid_generate_time __system_uuid_generate_time 45 | #define uuid_is_null __system_uuid_is_null 46 | #define semaphore_wait __system_semaphore_wait 47 | #define semaphore_destroy __system_semaphore_destroy 48 | #define thread_create __system_thread_create 49 | #define thread_terminate __system_thread_terminate 50 | #define task_t __system_task_t 51 | #define thread_t __system_thread_t 52 | #define uuid_t __darwin_uuid_t 53 | 54 | #include 55 | #include 56 | 57 | #undef semaphore_wait 58 | #undef semaphore_destroy 59 | #undef thread_create 60 | #undef thread_terminate 61 | 62 | #ifdef __OBJC__ 63 | #include_next 64 | #import 65 | #if FOUNDATION_PLATFORM_MACOS 66 | #import 67 | #elif FOUNDATION_PLATFORM_IOS 68 | #import 69 | #import 70 | #endif 71 | #else 72 | #include 73 | #if FOUNDATION_PLATFORM_MACOS 74 | #include 75 | #include 76 | #include 77 | #endif 78 | #endif 79 | 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | #undef semaphore_t 86 | #undef _UUID_T 87 | #undef uuid_generate_random 88 | #undef uuid_generate_time 89 | #undef uuid_is_null 90 | #undef task_t 91 | #undef thread_t 92 | #undef uuid_t 93 | 94 | #if FOUNDATION_COMPILER_CLANG 95 | #pragma clang diagnostic pop 96 | #endif 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /foundation/array.c: -------------------------------------------------------------------------------- 1 | /* array.c - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | 15 | //'FARR' in ascii 16 | static const uint32_t ARRAY_WATERMARK = 0x52524145U; 17 | static const unsigned int ARRAY_DEFAULT_ALIGN = 16U; 18 | 19 | const void* 20 | internal_array_verifyfn(const void* const* arr) { 21 | if (!FOUNDATION_VALIDATE_MSG(!(*arr) || (_array_raw_const(*arr)[2] == ARRAY_WATERMARK), 22 | "Invalid array (bad watermark)")) 23 | return 0; 24 | if (!FOUNDATION_VALIDATE_MSG(!(*arr) || (_array_raw_const(*arr)[1] <= _array_raw_const(*arr)[0]), 25 | "Invalid array (size > capacity)")) 26 | return 0; 27 | return *arr; 28 | } 29 | 30 | void* 31 | internal_array_resizefn(void** arr, size_t count, size_t itemsize) { 32 | if (!(*arr) && count) 33 | internal_array_growfn(arr, count, 1, itemsize); 34 | else if (*arr && (_array_rawcapacity(*arr) < count)) 35 | internal_array_growfn(arr, count - _array_rawcapacity(*arr), 1, itemsize); 36 | if (*arr) 37 | _array_rawsize(*arr) = (uint32_t)count; 38 | return *arr; 39 | } 40 | 41 | void* 42 | internal_array_growfn(void** arr, size_t count, size_t factor, size_t itemsize) { 43 | size_t prev_capacity = *arr ? _array_rawcapacity(*arr) : 0; 44 | size_t capacity = *arr ? (factor * prev_capacity + count) : count; 45 | size_t prev_storage_size = itemsize * prev_capacity; 46 | size_t storage_size = itemsize * capacity; 47 | size_t header_size = 4U * _array_header_size; 48 | size_t prev_used_buffer_size = prev_storage_size + header_size; 49 | size_t buffer_size = storage_size + header_size; 50 | uint32_t* buffer = 51 | *arr ? memory_reallocate(_array_raw(*arr), buffer_size, ARRAY_DEFAULT_ALIGN, prev_used_buffer_size, 0) : 52 | memory_allocate(0, buffer_size, ARRAY_DEFAULT_ALIGN, MEMORY_PERSISTENT); 53 | if (FOUNDATION_VALIDATE_MSG(buffer, "Failed to reallocate array storage")) { 54 | buffer[0] = (uint32_t)((memory_size(buffer) - header_size) / itemsize); 55 | if (!*arr) { 56 | buffer[1] = 0; 57 | buffer[2] = ARRAY_WATERMARK; 58 | buffer[3] = (uint32_t)itemsize; 59 | } 60 | *arr = buffer + _array_header_size; 61 | return *arr; 62 | } 63 | return nullptr; 64 | } 65 | -------------------------------------------------------------------------------- /foundation/assetstream.h: -------------------------------------------------------------------------------- 1 | /* assetstream.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file assetstream.h 16 | \brief Stream for Android application assets 17 | 18 | Stream for reading Android application assets, only available on Android platform. 19 | Asset streams are read only streams stored in the application package. For more information 20 | check the Android developer portal at 21 | http://developer.android.com/intl/ru/tools/projects/index.html#ApplicationModules 22 | 23 | Streams are not inherently thread safe, synchronization in a multithread use case must be done 24 | by caller. */ 25 | 26 | #include 27 | #include 28 | 29 | #if FOUNDATION_PLATFORM_ANDROID 30 | 31 | /*! Open an Android application asset as a stream. Assets are read only, no writing 32 | or creation of new streams is possible. 33 | \param path Asset path within the package asset paths 34 | \param length Length of asset path 35 | \param mode Open mode 36 | \return New stream, null if path not found or invalid mode */ 37 | FOUNDATION_API stream_t* 38 | asset_stream_open(const char* path, size_t length, unsigned int mode); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /foundation/atomic.c: -------------------------------------------------------------------------------- 1 | /* atomic.c - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #if FOUNDATION_COMPILER_MSVC 17 | 18 | #include 19 | 20 | void 21 | internal_atomic_thread_fence_sequentially_consistent() { 22 | MemoryBarrier(); 23 | } 24 | 25 | #endif 26 | 27 | int 28 | internal_atomic_initialize(void) { 29 | return 0; 30 | } 31 | 32 | void 33 | internal_atomic_finalize(void) { 34 | } 35 | -------------------------------------------------------------------------------- /foundation/base64.c: -------------------------------------------------------------------------------- 1 | /* base64.c - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | 15 | /*lint -e{840} We use null character in string literal deliberately here*/ 16 | static const char base64_decode_table[] = 17 | "|\0\0\0}rstuvwxyz{\0\0\0\0\0\0\0>?@ABCDEFGHIJKLMNOPQRSTUVW\0\0\0\0\0\0XYZ[\\]^_`" 18 | "abcdefghijklmnopq"; 19 | static const char base64_encode_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 20 | 21 | size_t 22 | base64_encode(const void* source, size_t size, char* destination, size_t capacity) { 23 | char* ptr; 24 | const unsigned char* carr; 25 | unsigned char bits; 26 | 27 | if (capacity > 0) { 28 | size_t maxsize = ((capacity - 1) / 4) * 3; 29 | if (maxsize < size) 30 | size = maxsize; 31 | } else { 32 | return 0; 33 | } 34 | 35 | carr = (const unsigned char*)source; 36 | ptr = destination; 37 | while (size > 2) { 38 | bits = (*carr >> 2) & 0x3F; 39 | *ptr++ = base64_encode_table[bits]; 40 | bits = (unsigned char)((*carr & 0x3) << 4) | ((*(carr + 1) >> 4) & 0xF); 41 | *ptr++ = base64_encode_table[bits]; 42 | bits = (unsigned char)((*(carr + 1) & 0xF) << 2) | ((*(carr + 2) >> 6) & 0x3); 43 | *ptr++ = base64_encode_table[bits]; 44 | bits = *(carr + 2) & 0x3F; 45 | *ptr++ = base64_encode_table[bits]; 46 | size -= 3; 47 | carr += 3; 48 | } 49 | if (size == 2) { 50 | bits = (*carr >> 2) & 0x3F; 51 | *ptr++ = base64_encode_table[bits]; 52 | bits = (unsigned char)((*carr & 0x3) << 4) | ((*(carr + 1) >> 4) & 0xF); 53 | *ptr++ = base64_encode_table[bits]; 54 | bits = (unsigned char)((*(carr + 1) & 0xF) << 2); 55 | *ptr++ = base64_encode_table[bits]; 56 | *ptr++ = '='; 57 | } else if (size == 1) { 58 | bits = (*carr >> 2) & 0x3F; 59 | *ptr++ = base64_encode_table[bits]; 60 | bits = (unsigned char)((*carr & 0x3) << 4); 61 | *ptr++ = base64_encode_table[bits]; 62 | *ptr++ = '='; 63 | *ptr++ = '='; 64 | } 65 | 66 | *ptr++ = 0; 67 | 68 | return (size_t)pointer_diff(ptr, destination); 69 | } 70 | 71 | size_t 72 | base64_decode(const char* source, size_t size, void* destination, size_t capacity) { 73 | size_t i, blocksize; 74 | char* cdst = (char*)destination; 75 | char* cdstend = cdst + capacity; 76 | while (size && (cdst < cdstend)) { 77 | unsigned char in[4] = {0, 0, 0, 0}; // Always build blocks of 4 bytes to decode, pad with 0 78 | blocksize = 0; 79 | for (i = 0; size && (i < 4); i++) { 80 | char v = 0; 81 | while (size && !v) { // Consume one valid byte from input, discarding invalid data 82 | v = *source++; 83 | v = ((v < 43 || v > 122) ? 0 : base64_decode_table[v - 43]); 84 | if (v) { 85 | in[i] = (unsigned char)(v - 62); 86 | blocksize++; 87 | } 88 | --size; 89 | } 90 | } 91 | if (blocksize > 1) { 92 | char out[3]; 93 | out[0] = (char)((in[0] << 2) | (in[1] >> 4)); 94 | out[1] = (char)((in[1] << 4) | (in[2] >> 2)); 95 | out[2] = (char)(((in[2] << 6) & 0xc0) | in[3]); 96 | for (i = 0; (i < blocksize - 1) && (cdst < cdstend); ++i) 97 | *cdst++ = out[i]; 98 | } 99 | } 100 | 101 | return (size_t)pointer_diff(cdst, destination); 102 | } 103 | -------------------------------------------------------------------------------- /foundation/base64.h: -------------------------------------------------------------------------------- 1 | /* base64.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file base64.h 16 | \brief Base64 encoding and decoding 17 | 18 | Base64 encoding and decoding, using [A-Z][a-z][0-9][+/] as encoding characters. For more 19 | information, see https://en.wikipedia.org/wiki/Base64 */ 20 | 21 | #include 22 | #include 23 | 24 | /*! Encode data in base64. Source and destination buffers must NOT be equal, encoding cannot 25 | be in-place as encoded base64 data occupies more memory space than input data (3 input bytes 26 | generate 4 output bytes). 27 | 28 | To encode entire source buffer, the destination buffer must be at least 29 | 1+(ceil(size/3)*4) bytes, including space for the terminating zero character. If the 30 | destination buffer is not large enough, the function will encode as much of source data that 31 | fits into the destination buffer, including a terminating zero (i.e ((capacity-1)/4)*3 bytes 32 | of source data). 33 | 34 | The destination buffer string will always be zero terminated. 35 | 36 | \param source Source data buffer 37 | \param size Size of source data buffer in bytes 38 | \param destination Destination string buffer 39 | \param capacity Capacity of destination string buffer in bytes 40 | \return Number of bytes written to destination string including terminating zero */ 41 | FOUNDATION_API size_t 42 | base64_encode(const void* source, size_t size, char* destination, size_t capacity); 43 | 44 | /*! Decode base64-encoded data. Any invalid characters, linebreaks and noise will be 45 | silently discarded. Source and destination buffers can be equal, since decoded data takes 46 | less space than source encoded data (4 input bytes generate 3 output bytes). 47 | 48 | To decode the entire source buffer, the destination buffer must be at least 49 | ((size-1)/4)*3 bytes. If the destination buffer is not large enough, the function will 50 | decode as much of the source data that fits into the destination buffer (i.e 51 | 1+(ceil(capacity/3)*4) bytes of source data). 52 | 53 | \param source Source string buffer 54 | \param size Size of source string buffer in bytes (NOT including zero terminator) 55 | \param destination Destination buffer 56 | \param capacity Capacity of destination buffer in bytes 57 | \return Number of bytes written to destination buffer */ 58 | FOUNDATION_API size_t 59 | base64_decode(const char* source, size_t size, void* destination, size_t capacity); 60 | -------------------------------------------------------------------------------- /foundation/blowfish.h: -------------------------------------------------------------------------------- 1 | /* blowfish.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file blowfish.h 16 | \brief Blowfish encryption and decryption 17 | 18 | Blowfish encryption and decryption. Blowfish is a symmetric block cipher with variable length key. 19 | For more information, see https://www.schneier.com/blowfish.html 20 | 21 | The blowfish state is not inherently thread safe, synchronization in a multithread use case must 22 | be done by caller. */ 23 | 24 | #include 25 | #include 26 | 27 | /*! Allocate a blowfish state object. Does NOT initialize the object, must 28 | be done with a call to #blowfish_initialize before using the object for 29 | encryption/descryption. 30 | \return New blowfish state object */ 31 | FOUNDATION_API blowfish_t* 32 | blowfish_allocate(void); 33 | 34 | /*! Deallocate a blowfish state object and free resources 35 | \param blowfish Blowfish state object to deallocate */ 36 | FOUNDATION_API void 37 | blowfish_deallocate(blowfish_t* blowfish); 38 | 39 | /*! Initialize the blowfish state object with the given key data. After 40 | a call to this function the state object can be used for encryption/decryption. 41 | \param blowfish Blowfish state object 42 | \param key Key data 43 | \param length Length of key data in bytes */ 44 | FOUNDATION_API void 45 | blowfish_initialize(blowfish_t* blowfish, const void* key, size_t length); 46 | 47 | /*! Finalize a blowfish state object and free resources 48 | \param blowfish Blowfish state object to finalize */ 49 | FOUNDATION_API void 50 | blowfish_finalize(blowfish_t* blowfish); 51 | 52 | /*! Encrypt data using the given blowfish state object. Encryption is done in-place, 53 | no memory allocation is done internally. Length is expected to be a multiple of 8 54 | bytes (any extra unaligned data will be ignored). 55 | \param blowfish Blowfish state object 56 | \param data Data buffer 57 | \param length Length of data buffer in bytes 58 | \param mode Mode of operation (see #blockcipher_mode_t) 59 | \param vec Initialization vector */ 60 | FOUNDATION_API void 61 | blowfish_encrypt(const blowfish_t* blowfish, void* data, size_t length, blockcipher_mode_t mode, uint64_t vec); 62 | 63 | /*! Decrypt data using the given blowfish state object. Decryption is done in-place, 64 | no memory allocation is done internally. Length is expected to be a multiple of 8 65 | bytes (any extra unaligned data will be ignored). 66 | \param blowfish Blowfish state object 67 | \param data Data buffer 68 | \param length Length of data buffer in bytes 69 | \param mode Mode of operation (see #blockcipher_mode_t) 70 | \param vec Initialization vector */ 71 | FOUNDATION_API void 72 | blowfish_decrypt(const blowfish_t* blowfish, void* data, size_t length, blockcipher_mode_t mode, uint64_t vec); 73 | -------------------------------------------------------------------------------- /foundation/bufferstream.h: -------------------------------------------------------------------------------- 1 | /* bufferstream.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file bufferstream.h 16 | \brief Stream for memory buffer 17 | 18 | Stream for memory buffer, both statically sized and dynamically reallocated buffers. Streams are 19 | not inherently thread safe, synchronization in a multithread use case must be done by caller. 20 | 21 | Seeking in a buffer stream will not resize the storage buffer or change the current stream size. 22 | To change stream size and allocate buffer space use #stream_truncate. */ 23 | 24 | #include 25 | #include 26 | 27 | /*! Allocate a new stream for memory buffers from an (optionally) existing buffer. 28 | The buffer can grow up to the given capacity. If adopt and grow flags set it 29 | will grow to any required size reallocating memory. The stream should be 30 | deallocated with a call to #stream_deallocate. 31 | \param buffer Buffer 32 | \param mode Stream open mode 33 | \param size Current size of data 34 | \param capacity Buffer capacity 35 | \param adopt Take ownership of buffer 36 | \param grow Allow growing buffer by reallocating memory (requires buffer to be adopted) 37 | \return New stream */ 38 | FOUNDATION_API stream_t* 39 | buffer_stream_allocate(void* buffer, unsigned int mode, size_t size, size_t capacity, bool adopt, bool grow); 40 | 41 | /*! Initialize a new stream for memory buffers from an (optionally) existing buffer. 42 | The buffer can grow up to the given capacity. If adopt and grow flags set it will 43 | grow to any required size reallocating memory. The stream should be finalized with 44 | a call to #stream_finalize 45 | \param stream Stream object 46 | \param buffer Buffer 47 | \param mode Stream open mode 48 | \param size Current size of data 49 | \param capacity Buffer capacity 50 | \param adopt Take ownership of buffer 51 | \param grow Allow growing buffer by reallocating memory (requires buffer to be adopted) */ 52 | FOUNDATION_API void 53 | buffer_stream_initialize(stream_buffer_t* stream, void* buffer, unsigned int mode, size_t size, size_t capacity, 54 | bool adopt, bool grow); 55 | -------------------------------------------------------------------------------- /foundation/delegate.h: -------------------------------------------------------------------------------- 1 | /* delegate.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file delegate.h 16 | \brief Application delegate 17 | 18 | Application delegate and entry points for macOS and iOS */ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #if FOUNDATION_PLATFORM_MACOS || FOUNDATION_PLATFORM_IOS 26 | 27 | /*! macOS and iOS only. Start the main thread as a separate thread. The process entry thread 28 | will go on and run the main Cocoa event loop. */ 29 | FOUNDATION_API void 30 | delegate_start_main_ns_thread(void); 31 | 32 | /*! macOS and iOS only. Ensures all delegate classes and methods have references to prevent 33 | from being stripped in optimization passes during compilation and linking */ 34 | FOUNDATION_API void 35 | delegate_reference_classes(void); 36 | 37 | #endif 38 | 39 | #if FOUNDATION_PLATFORM_MACOS 40 | 41 | /*! macOS only. Get the currently assigned window from the delegate object window outlet. 42 | \return Window object */ 43 | FOUNDATION_API void* 44 | delegate_window(void); 45 | 46 | #if defined(__OBJC__) && !defined(FOUNDATION_NO_INTERFACE) 47 | 48 | /*! Application delegate for foundation library projects. Assign the main application window 49 | object to the window outlet for automatic integration between foundation library and 50 | windowing services */ 51 | @interface FoundationAppDelegate : NSObject 52 | @property (nonatomic, retain) IBOutlet NSWindow* window; 53 | + (void)referenceClass; 54 | @end 55 | 56 | #endif 57 | 58 | #endif 59 | 60 | #if FOUNDATION_PLATFORM_IOS 61 | 62 | /*! iOS only. Get the main UI application window. 63 | \return Windows object */ 64 | FOUNDATION_API void* 65 | delegate_window(void); 66 | 67 | #if defined(__OBJC__) && !defined(FOUNDATION_NO_INTERFACE) 68 | 69 | @interface FoundationAppDelegate : NSObject 70 | @property (nonatomic, retain) IBOutlet UIWindow* window; 71 | + (void)referenceClass; 72 | @end 73 | 74 | /*! UI alert view delegate used by system debug message alert views */ 75 | @interface FoundationAlertViewDelegate : NSObject 76 | @end 77 | 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /foundation/exception.h: -------------------------------------------------------------------------------- 1 | /* exception.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file exception.h 16 | \brief Exception handling 17 | 18 | Exception handling for structured exception handling and signals. */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Guard the given method and generate a dump if the function generates an exception, 24 | such as a termination signal or structured exception. 25 | \param fn Function to wrap 26 | \param data Argument 27 | \param handler Exception handler 28 | \param name Dump name prefix 29 | \param length Length of dump name prefix 30 | \return Function return value, FOUNDATION_EXCEPTION_DUMP_GENERATED if dump was generated */ 31 | FOUNDATION_API int 32 | exception_try(exception_try_fn fn, void* data, exception_handler_fn handler, const char* name, size_t length); 33 | 34 | /*! Set the global exception handler and dump name prefix. This will be used or all new 35 | threads created. 36 | \param handler Exception handler 37 | \param name Dump name prefix 38 | \param length Length of dump name prefix */ 39 | FOUNDATION_API void 40 | exception_set_handler(exception_handler_fn handler, const char* name, size_t length); 41 | 42 | /*! Get current global exception handler 43 | \return Exception handler function */ 44 | FOUNDATION_API exception_handler_fn 45 | exception_handler(void); 46 | 47 | /*! Get current global dump name prefix 48 | \return Dump name prefix */ 49 | FOUNDATION_API string_const_t 50 | exception_dump_name(void); 51 | 52 | /*! Raise a debug break exception that will be caught by any attached debugger */ 53 | FOUNDATION_API void 54 | exception_raise_debug_break(void) FOUNDATION_ATTRIBUTE(noreturn); 55 | 56 | /*! Raise exception by performing an illegal instruction, causing the process to 57 | core dump */ 58 | FOUNDATION_API void 59 | exception_raise_abort(void) FOUNDATION_ATTRIBUTE(noreturn); 60 | -------------------------------------------------------------------------------- /foundation/hash.h: -------------------------------------------------------------------------------- 1 | /* hash.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file hash.h 16 | \brief Murmur3 hash 17 | 18 | Murmur3 hash from http://code.google.com/p/smhasher/ 19 | 20 | Wrapper macros around predefined static hashed strings. See hashify utility for 21 | creating static hashes */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #if BUILD_ENABLE_STATIC_HASH_DEBUG 28 | #include 29 | #endif 30 | 31 | /*! Hash data memory blob. Pointer must be aligned to 8 bytes 32 | \param key Key to hash 33 | \param len Length of key in bytes 34 | \return Hash of key */ 35 | FOUNDATION_API FOUNDATION_PURECALL hash_t 36 | hash(const void* key, size_t len); 37 | 38 | /*! Reverse hash lookup. Only available if #BUILD_ENABLE_STATIC_HASH_DEBUG is 39 | enabled, otherwise if will always return an empty string 40 | \param value Hash value 41 | \return String matching hash value, or empty string if not found */ 42 | FOUNDATION_API string_const_t 43 | hash_to_string(hash_t value); 44 | 45 | #if BUILD_ENABLE_STATIC_HASH_DEBUG 46 | 47 | static FOUNDATION_FORCEINLINE hash_t 48 | static_hash(const void* key, size_t len, hash_t value); 49 | 50 | #else 51 | 52 | #define static_hash(key, len, value) ((void)sizeof(key), (void)sizeof(len), (hash_t)(value)) 53 | 54 | #define hash_to_string(value) ((void)sizeof(value), (const char*)0) 55 | 56 | #endif 57 | 58 | /*! Declare a statically hashed string. If #BUILD_ENABLE_STATIC_HASH_DEBUG is enabled 59 | in the build config this will allow the string to be reverse looked up with hash_to_string. 60 | Static hash strings are usually defined by using the hashify tool on a declaration file, 61 | see the hashstrings.txt and corresponding hashstrings.h header 62 | \param key Key string 63 | \param len Length of key in bytes 64 | \param value Hash value */ 65 | #define static_hash_string(key, len, value) static_hash(key, len, (hash_t)value) 66 | 67 | #if BUILD_ENABLE_STATIC_HASH_DEBUG 68 | 69 | FOUNDATION_API void 70 | static_hash_store(const void* key, size_t len, hash_t value); 71 | 72 | static FOUNDATION_FORCEINLINE hash_t 73 | static_hash(const void* key, size_t len, hash_t value) { 74 | hash_t ref = hash(key, len); 75 | FOUNDATION_ASSERT_MSGFORMAT(!value || (ref == value), "Static hash fail: %s -> 0x%" PRIx64 ", expected 0x%" PRIx64, 76 | (const char*)key, ref, value); 77 | static_hash_store(key, len, ref); 78 | return ref; 79 | } 80 | 81 | #endif 82 | 83 | /*! Hash of an empty/null string (length 0) */ 84 | #define HASH_EMPTY_STRING 0xC2D00F032E25E509ULL 85 | 86 | /*! Null hash value */ 87 | #define HASH_NULL 0ULL 88 | -------------------------------------------------------------------------------- /foundation/hashstrings.txt: -------------------------------------------------------------------------------- 1 | 2 | HASH_FOUNDATION foundation 3 | HASH_DEFAULT default 4 | HASH_TRUE true 5 | HASH_FALSE false 6 | HASH_LOCALE locale 7 | HASH_APPLICATION application 8 | HASH_USER user 9 | HASH_DAEMON daemon 10 | HASH_MEMORY memory 11 | HASH_TEMPORARY_MEMORY temporary_memory 12 | HASH_MEMORY_TRACKER memory_tracker 13 | HASH_LOCAL local 14 | HASH_REMOTE remote 15 | HASH_NONE none 16 | HASH_TEST test 17 | HASH_STREAM stream 18 | HASH_STRING string 19 | HASH_BENCHMARK benchmark 20 | HASH_TOOL tool 21 | HASH_CONFIG config 22 | HASH_ENVIRONMENT environment 23 | HASH_EXECUTABLE_NAME executable_name 24 | HASH_EXECUTABLE_DIRECTORY executable_directory 25 | HASH_EXECUTABLE_PATH executable_path 26 | HASH_INITIAL_WORKING_DIRECTORY initial_working_directory 27 | HASH_CURRENT_WORKING_DIRECTORY current_working_directory 28 | HASH_APPLICATION_DIRECTORY application_directory 29 | HASH_TEMPORARY_DIRECTORY temporary_directory 30 | HASH_SYSTEM system 31 | HASH_DEBUG debug 32 | HASH_FS fs 33 | HASH_SOURCE source 34 | HASH_EVENT event 35 | HASH_VERSION version 36 | -------------------------------------------------------------------------------- /foundation/library.h: -------------------------------------------------------------------------------- 1 | /* library.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file library.h 16 | \brief Dynamic library loader 17 | 18 | Dynamic library loader for platforms supporting this concept. */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Load library. Where libraries are searched is system dependent. If the 24 | same library was already previously loaded, a new reference to the same library 25 | object will be returned, otherwise a new library object will be created and 26 | referenced. 27 | 28 | Use #library_unload to release a reference to a library object. 29 | 30 | If the given name does not contain the platform specific dynamic library prefix 31 | and extension, the function will also try loading the library with this prefix and 32 | extension added. If the name contains a path, it should be on the standard format 33 | as returned by #path_clean 34 | 35 | On platforms where dynamic library loading is not supported a not implemented 36 | error will be reported. 37 | \param name Dynamic library name (or optional path) 38 | \param length Length of name/path 39 | \return Null if not found or error loading, library object reference if loaded successfully */ 40 | FOUNDATION_API object_t 41 | library_load(const char* name, size_t length); 42 | 43 | /*! Reference library, explicitly increase the reference count of the library object. 44 | Use #library_unload to release a reference to a library object. 45 | \param library Library object 46 | \return Object handle if library object is still valid, 0 if library object is no longer valid */ 47 | FOUNDATION_API object_t 48 | library_ref(object_t library); 49 | 50 | /*! Release a reference to the library object. Once the library object 51 | has no more references, the underlying structure will be deallocated and the system resources 52 | associated will be released. 53 | \param library Library object */ 54 | FOUNDATION_API void 55 | library_release(object_t library); 56 | 57 | /*! Lookup a symbol by name in the library. 58 | \param library Library object 59 | \param name Symbol name 60 | \param length Length of symbol name 61 | \return Address of symbol, 0 if not found */ 62 | FOUNDATION_API void* 63 | library_symbol(object_t library, const char* name, size_t length); 64 | 65 | /*! Get library name 66 | \param library Library object 67 | \return Library name, empty string if not a valid library */ 68 | FOUNDATION_API string_const_t 69 | library_name(object_t library); 70 | 71 | /*! Query if valid library 72 | \param library Library object 73 | \return true if loaded and valid, false if not */ 74 | FOUNDATION_API bool 75 | library_valid(object_t library); 76 | -------------------------------------------------------------------------------- /foundation/main.h: -------------------------------------------------------------------------------- 1 | /* main.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file main.h 16 | \brief Main entry points 17 | 18 | Main application entry points. The library implements the platform specific 19 | entry points into the application (like int main(...) for normal 20 | C library based applications) and handles the initial setup. 21 | 22 | The foundation library then calls into these entry points to provide the 23 | application with a unified single entry point for each application lifetime 24 | event (initialize, run and finalize). */ 25 | 26 | #include 27 | #include 28 | 29 | #if !BUILD_DYNAMIC_LINK 30 | 31 | /*! Main initialization entry point. This must be implemented by the application. 32 | The expectation is that this function will call foundation_initialize 33 | to initialize the foundation library, and return an error code 34 | to indicate success or failure. If this method returns an error initialization 35 | will abort and the program will terminate. 36 | \return 0 for success, <0 for error */ 37 | FOUNDATION_EXTERN int 38 | main_initialize(void); 39 | 40 | /*! Main loop. This must be implementation by the application and should 41 | contain the main run loop. Once this function returns the application 42 | will terminate. The return code is used as the process exit code 43 | for normal termination. Will be called after #main_initialize 44 | \param arg Unused, set to 0 45 | \return Process exit code */ 46 | FOUNDATION_EXTERN int 47 | main_run(void* arg); 48 | 49 | /*! Main exit point. This must be implemented by the application. 50 | The expectation is that this function will call foundation_finalize 51 | to terminate the foundation library. Will be called after #main_run */ 52 | FOUNDATION_EXTERN void 53 | main_finalize(void); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /foundation/md5.h: -------------------------------------------------------------------------------- 1 | /* md5.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file md5.h 16 | \brief MD5 algorithm 17 | 18 | MD5 message-digest algorithm. Inspired by Alexander Peslyak's public domain implementation 19 | available at http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 20 | 21 | Normal use case is to first allocate/initialize the md5 block, then do any number of 22 | initialize-digest-finalize call sequences: 23 | 24 |
md5_initialize()
25 | md5_digest()
26 | md5_digest()
27 | ... //More digest operations
28 | md5_digest_finalize()
29 | md5_get_digest()
30 | md5_get_digest_raw()
31 | ... //More initialize, digest sequences
32 | md5_finalize()
*/ 33 | 34 | #include 35 | #include 36 | 37 | /*! Allocate a new MD5 block and initialize for digestion. 38 | \return New MD5 block */ 39 | FOUNDATION_API md5_t* 40 | md5_allocate(void); 41 | 42 | /*! Deallocate MD5 block 43 | \param digest MD5 block */ 44 | FOUNDATION_API void 45 | md5_deallocate(md5_t* digest); 46 | 47 | /*! Initialize MD5 block. Must be called before each block of digest operations 48 | with #md5_digest 49 | \param digest MD5 block */ 50 | FOUNDATION_API void 51 | md5_initialize(md5_t* digest); 52 | 53 | /*! Finalize MD5 block previously initialized with #md5_initialize. After this call the 54 | block may no longer be used until a new #md5_initialize call is made. 55 | \param digest MD5 block */ 56 | FOUNDATION_API void 57 | md5_finalize(md5_t* digest); 58 | 59 | /*! Digest a raw data buffer. 60 | \param digest MD5 block 61 | \param buffer Data to digest 62 | \param size Size of buffer 63 | \return MD5 block */ 64 | FOUNDATION_API md5_t* 65 | md5_digest(md5_t* digest, const void* buffer, size_t size); 66 | 67 | /*! Finalize digest. Must be called between digesting data with #md5_digest 68 | and getting the final message digest with #md5_get_digest/#md5_get_digest_raw. If a new 69 | digest sequence is required the block must be re-initialized with a call to #md5_initialize. 70 | \param digest MD5 block */ 71 | FOUNDATION_API void 72 | md5_digest_finalize(md5_t* digest); 73 | 74 | /*! Get digest as string. Before getting the digest string the MD5 block must be 75 | finalized with a call to #md5_digest_finalize. 76 | \param digest MD5 block 77 | \param buffer String buffer 78 | \param capacity Capacity of string buffer 79 | \return Message digest string */ 80 | FOUNDATION_API string_t 81 | md5_get_digest(const md5_t* digest, char* buffer, size_t capacity); 82 | 83 | /*! Get digest as raw 128-bit value. Before getting the raw digest the MD5 block must be 84 | finalized with a call to #md5_digest_finalize. 85 | \param digest MD5 block 86 | \return Message digest */ 87 | FOUNDATION_API uint128_t 88 | md5_get_digest_raw(const md5_t* digest); 89 | -------------------------------------------------------------------------------- /foundation/pipe.h: -------------------------------------------------------------------------------- 1 | /* pipe.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file pipe.h 16 | \brief Unnamed pipe stream 17 | 18 | Stream for unnamed pipes, usable for inter-process communication. Pipe read/write calls 19 | are blocking. Pipe streams are sequential (non-seekable). */ 20 | 21 | #include 22 | #include 23 | 24 | /*! Allocate an unnamed pipe stream. Deallocate the stream with a call to #stream_deallocate 25 | \return New pipe stream */ 26 | FOUNDATION_API stream_t* 27 | pipe_allocate(void); 28 | 29 | /*! Initialize an unnamed pipe stream. Finalize the stream with a call to #stream_finalize 30 | \param pipe Pipe stream */ 31 | FOUNDATION_API void 32 | pipe_initialize(stream_pipe_t* pipe); 33 | 34 | /*! Close read end of pipe 35 | \param pipe Pipe stream */ 36 | FOUNDATION_API void 37 | pipe_close_read(stream_t* pipe); 38 | 39 | /*! Close write end of pipe 40 | \param pipe Pipe stream */ 41 | FOUNDATION_API void 42 | pipe_close_write(stream_t* pipe); 43 | 44 | #if FOUNDATION_PLATFORM_WINDOWS 45 | 46 | /*! Windows only, get OS handle for read end of pipe 47 | \param pipe Pipe stream 48 | \return Read object handle */ 49 | FOUNDATION_API void* 50 | pipe_read_handle(stream_t* pipe); 51 | 52 | /*! Windows only, get OS handle for write end of pipe 53 | \param pipe Pipe stream 54 | \return Write object handle */ 55 | FOUNDATION_API void* 56 | pipe_write_handle(stream_t* pipe); 57 | 58 | #endif 59 | 60 | /*! Get OS file descriptor for read end of pipe 61 | \param pipe Pipe stream 62 | \return Read file descriptor */ 63 | FOUNDATION_API int 64 | pipe_read_fd(stream_t* pipe); 65 | 66 | /*! Get OS file descriptor for write end of pipe 67 | \param pipe Pipe stream 68 | \return Write file descriptor */ 69 | FOUNDATION_API int 70 | pipe_write_fd(stream_t* pipe); 71 | -------------------------------------------------------------------------------- /foundation/posix.h: -------------------------------------------------------------------------------- 1 | /* posix.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file posix.h 16 | \brief Safe inclusion of posix headers 17 | 18 | Safe inclusion of posix headers */ 19 | 20 | #include 21 | #include 22 | 23 | #if FOUNDATION_PLATFORM_POSIX 24 | 25 | #if FOUNDATION_COMPILER_GCC 26 | #pragma GCC diagnostic push 27 | #if FOUNDATION_GCC_VERSION > 40700 28 | #pragma GCC diagnostic ignored "-Wpedantic" 29 | #endif 30 | #elif FOUNDATION_COMPILER_CLANG 31 | #pragma clang diagnostic push 32 | #if __has_warning("-Wreserved-id-macro") 33 | #pragma clang diagnostic ignored "-Wreserved-id-macro" 34 | #endif 35 | #if __has_warning("-Wpedantic") 36 | #pragma clang diagnostic ignored "-Wpedantic" 37 | #endif 38 | #if __has_warning("-Wundef") 39 | #pragma clang diagnostic ignored "-Wundef" 40 | #endif 41 | #if __has_warning("-Wpacked") 42 | #pragma clang diagnostic ignored "-Wpacked" 43 | #endif 44 | #endif 45 | 46 | #define radixsort __stdlib_radixsort 47 | #ifndef __error_t_defined 48 | #define __error_t_defined 1 49 | #endif 50 | 51 | #if FOUNDATION_PLATFORM_APPLE 52 | #define _UUID_T 53 | #define _UUID_UUID_H 54 | #endif 55 | 56 | #ifndef _GNU_SOURCE 57 | #define _GNU_SOURCE 1 58 | #endif 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | 78 | #if FOUNDATION_PLATFORM_LINUX || FOUNDATION_PLATFORM_ANDROID 79 | #include 80 | #include 81 | #endif 82 | 83 | #if !FOUNDATION_PLATFORM_ANDROID 84 | #include 85 | #endif 86 | 87 | #undef radixsort 88 | 89 | #if FOUNDATION_PLATFORM_APPLE 90 | #undef _UUID_T 91 | #undef _UUID_UUID_H 92 | #endif 93 | 94 | #if FOUNDATION_COMPILER_GCC 95 | #pragma GCC diagnostic pop 96 | #elif FOUNDATION_COMPILER_CLANG 97 | #pragma clang diagnostic pop 98 | #endif 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /foundation/radixsort.h: -------------------------------------------------------------------------------- 1 | /* radixsort.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file radixsort.h 16 | \brief Radix sorter 17 | 18 | Radix sorter for 32/64-bit integer and floating point values. */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Allocate a radix sort object. All data is stored in a single continuous memory block, 24 | including sort buckets and resulting index arrays. Deallocate the sort object with a call to 25 | #radixsort_deallocate. 26 | \param type Data type 27 | \param count Number of elements to sort 28 | \return New radix sort object */ 29 | FOUNDATION_API radixsort_t* 30 | radixsort_allocate(radixsort_data_t type, size_t count); 31 | 32 | /*! Allocate a radix sort object for opaque custom data. All data is stored in a single continuous memory block, 33 | including sort buckets and resulting index arrays. Deallocate the sort object with a call to 34 | #radixsort_deallocate. 35 | \param data_size Size of data type in bytes 36 | \param count Number of elements to sort 37 | \return New radix sort object */ 38 | FOUNDATION_API radixsort_t* 39 | radixsort_allocate_custom(size_t data_size, size_t count); 40 | 41 | /*! Deallocate a radix sort object previously allocated with a call to #radixsort_allocate. 42 | \param sort Radix sort object to deallocate */ 43 | FOUNDATION_API void 44 | radixsort_deallocate(radixsort_t* sort); 45 | 46 | /*! Initialize a radix sort object. All data pointers should be set by the caller. Finalize 47 | the sort object with a call to #radixsort_finalize. 48 | \param sort Radix sort object 49 | \param type Data type 50 | \param count Number of elements to sort */ 51 | FOUNDATION_API void 52 | radixsort_initialize(radixsort_t* sort, radixsort_data_t type, size_t count); 53 | 54 | /*! Initialize a radix sort object for custom opaque data. All data pointers should be set by the caller. Finalize 55 | the sort object with a call to #radixsort_finalize. 56 | \param sort Radix sort object 57 | \param data_size Size of data type in bytes 58 | \param count Number of elements to sort */ 59 | FOUNDATION_API void 60 | radixsort_initialize_custom(radixsort_t* sort, size_t data_size, size_t count); 61 | 62 | /*! Finalize a radix sort object previously initialized with a call to #radixsort_initialize. 63 | \param sort Radix sort object to finalize */ 64 | FOUNDATION_API void 65 | radixsort_finalize(radixsort_t* sort); 66 | 67 | /*! Perform radix sort. This will take advantage of temporal coherence if the input is 68 | partially sorted and/or used in a previous sort call on this radix sort object. 69 | \param sort Radix sort object 70 | \param input Input data buffer of same type as radix sort object was 71 | initialized with 72 | \param count Number of elements to sort, must be less or equal to maximum 73 | number radix sort object was initialized with 74 | \return Sorted index array holding num indices into the input array, data type depending 75 | on sort index type (16-bit or 32-bit) */ 76 | FOUNDATION_API const void* 77 | radixsort_sort(radixsort_t* sort, const void* input, size_t count); 78 | -------------------------------------------------------------------------------- /foundation/regex.h: -------------------------------------------------------------------------------- 1 | /* regex.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file regex.h 16 | \brief Small regular expression implementation 17 | 18 | Small regular expression implementation matching a subset of Perl regular expression syntax. 19 |
    ^        Match beginning of string
20 |     $        Match end of string
21 |     .        Match one character
22 |     ()       Group and capture substring
23 |     []       Match any character from the grouped set
24 |     [^]      Match any character but ones from the grouped set
25 |     \\s       Match whitespace
26 |     \\S       Match non-whitespace
27 |     \\d       Match decimal digits
28 |     \\D       Match non-digits
29 |     \\n       Match newline
30 |     \\r       Match carriage return
31 |     +        Match one or more times (longest possible match)
32 |     +?       Match one or more times (shortest possible match)
33 |     *        Match zero or more times (longest possible match)
34 |     *?       Match zero or more times (shortest possible match)
35 |     ?        Match zero or once
36 |     \\XX      Match byte with hex value 0xXX (must be two hex digits)
37 |     \\meta    Match one of the meta characters ^$()[].*+?|\
38 | 
*/ 39 | 40 | #include 41 | 42 | /*! Compile (allocate and parse) a regular expression 43 | \param pattern Pattern string 44 | \param length Length of pattern string 45 | \return Compiled expression, null if error */ 46 | FOUNDATION_API regex_t* 47 | regex_compile(const char* pattern, size_t length); 48 | 49 | /*! Compile (parse) a regular expression into a predefined expression buffer 50 | \param regex Predefined expression buffer 51 | \param pattern Pattern string 52 | \param length Length of pattern string 53 | \return true if successful, false if not */ 54 | FOUNDATION_API bool 55 | regex_parse(regex_t* regex, const char* pattern, size_t length); 56 | 57 | /*! Match input string with regular expression with optional captures. Note that captures array 58 | might be modified and contain invalid data even if regex fails. If the regex matches, the 59 | captures array will contain valid data. 60 | \param regex Compiled expression 61 | \param input Input string 62 | \param inlength Length of input string 63 | \param captures Result capture array, null if not wanted 64 | \param maxcaptures Maximum number of captures 65 | \return true if string matches expression, false if not */ 66 | FOUNDATION_API bool 67 | regex_match(regex_t* regex, const char* input, size_t inlength, string_const_t* captures, size_t maxcaptures); 68 | 69 | /*! Free a compiled expression 70 | \param regex Compiled expression */ 71 | FOUNDATION_API void 72 | regex_deallocate(regex_t* regex); 73 | -------------------------------------------------------------------------------- /foundation/semaphore.h: -------------------------------------------------------------------------------- 1 | /* semaphore.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file semaphore.h 16 | \brief Semaphore 17 | 18 | Semaphore for thread synchronization and notification. For more information, see 19 | https://en.wikipedia.org/wiki/Semaphore_(programming) */ 20 | 21 | #include 22 | #include 23 | 24 | /*! Initialize unnamed semaphore with the given value. 25 | \param semaphore Semaphore 26 | \param value Initial value 27 | \return true if successful, false if error */ 28 | FOUNDATION_API bool 29 | semaphore_initialize(semaphore_t* semaphore, uint value); 30 | 31 | /*! Initialize a named semaphore with the given value. 32 | \param semaphore Semaphore 33 | \param name Global name 34 | \param length Length of name 35 | \param value Initial value 36 | \return true if successful, false if error */ 37 | FOUNDATION_API bool 38 | semaphore_initialize_named(semaphore_t* semaphore, const char* name, size_t length, uint value); 39 | 40 | /*! Finalize semaphore. The semaphore value must be >= than the value it was created with, 41 | or it will be considered to be still in use (on OSX/iOS targets this will cause a debug abort). 42 | \param semaphore Semaphore */ 43 | FOUNDATION_API void 44 | semaphore_finalize(semaphore_t* semaphore); 45 | 46 | /*! Wait on semaphore indefinitely 47 | \param semaphore Semaphore 48 | \return true if successful, false if error or interrupted */ 49 | FOUNDATION_API bool 50 | semaphore_wait(semaphore_t* semaphore); 51 | 52 | /*! Try waiting on semaphore for a given amount of time. 53 | \param semaphore Semaphore 54 | \param milliseconds Timeout in milliseconds, 0 means no wait 55 | \return true if successful, false if timeout or error/interrupted */ 56 | FOUNDATION_API bool 57 | semaphore_try_wait(semaphore_t* semaphore, uint milliseconds); 58 | 59 | /*! Post semaphore. 60 | \param semaphore Semaphore */ 61 | FOUNDATION_API void 62 | semaphore_post(semaphore_t* semaphore); 63 | 64 | /*! Post semaphore multiple times 65 | \param semaphore Semaphore 66 | \param count Number of times */ 67 | FOUNDATION_API void 68 | semaphore_post_multiple(semaphore_t* semaphore, uint count); 69 | 70 | #if FOUNDATION_PLATFORM_WINDOWS 71 | 72 | /*! Windows only, get OS handle for semaphore 73 | \param semaphore Semaphore 74 | \return Object handle */ 75 | FOUNDATION_API void* 76 | semaphore_event_handle(semaphore_t* semaphore); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /foundation/stacktrace.h: -------------------------------------------------------------------------------- 1 | /* stacktrace.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file stacktrace.h 16 | \brief Stacktrace utilities 17 | 18 | Stacktrace utilities */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Capture stack trace. If not supported, number of captured frames will be zero. 24 | \param trace Stack trace buffer. Must be able to hold max_depth number of frame pointers. 25 | \param max_depth Maximum call stack depth to capture 26 | \param skip_frames Number of initial frames to skip before starting capture 27 | \return Number of stack frames captured */ 28 | FOUNDATION_API size_t 29 | stacktrace_capture(void** trace, size_t max_depth, size_t skip_frames); 30 | 31 | /*! Resolve a previously captured stack trace 32 | \param str Buffer for resolved stack trace string 33 | \param capacity Capacity of buffer 34 | \param trace Stack trace buffer 35 | \param max_depth Maximum call stack depth to resolve 36 | \param skip_frames Number of initial frames to skip before starting resolve 37 | \return Resolved stack trace string, empty string if unable to resolve */ 38 | FOUNDATION_API string_t 39 | stacktrace_resolve(char* str, size_t capacity, void* const* trace, size_t max_depth, size_t skip_frames); 40 | -------------------------------------------------------------------------------- /foundation/time.h: -------------------------------------------------------------------------------- 1 | /* time.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file time.h 16 | \brief Time measurements 17 | 18 | Time measurements. */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Get current timestamp, in ticks of system-specific frequency (queryable with 24 | #time_ticks_per_second), measured from some system-specific base timestamp and not in sync 25 | with other timestamps. 26 | \return Current timestamp */ 27 | FOUNDATION_API tick_t 28 | time_current(void); 29 | 30 | /*! Calculate time difference. 31 | \param from Start timestamp 32 | \param to End timestamp 33 | \return Elapsed time (difference) in ticks */ 34 | FOUNDATION_API tick_t 35 | time_diff(const tick_t from, const tick_t to); 36 | 37 | /*! Get elapsed time since given timestamp. 38 | \param since Timestamp 39 | \return Number of seconds elapsed */ 40 | FOUNDATION_API deltatime_t 41 | time_elapsed(const tick_t since); 42 | 43 | /*! Get elapsed ticks since given timestamp. 44 | \param since Timestamp 45 | \return Number of ticks elapsed */ 46 | FOUNDATION_API tick_t 47 | time_elapsed_ticks(const tick_t since); 48 | 49 | /*! Get time frequency, as number of ticks per second. 50 | \return Ticks per second */ 51 | FOUNDATION_API tick_t 52 | time_ticks_per_second(void); 53 | 54 | /*! Get ticks as seconds (effectively calculating ticks / time_ticks_per_second()). 55 | \param dt Deltatime in ticks 56 | \return Deltatime in seconds */ 57 | FOUNDATION_API deltatime_t 58 | time_ticks_to_seconds(const tick_t dt); 59 | 60 | /*! Get ticks as milliseconds (effectively calculating 1000.0 * (ticks / 61 | time_ticks_per_second())). \param dt Deltatime in ticks \return Deltatime in milliseconds */ 62 | FOUNDATION_API deltatime_t 63 | time_ticks_to_milliseconds(const tick_t dt); 64 | 65 | /*! Get startup timestamp. 66 | \return Startup timestamp */ 67 | FOUNDATION_API tick_t 68 | time_startup(void); 69 | 70 | /*! Get system time, in milliseconds since the epoch (UNIX time). 71 | \return Current timestamp, in milliseconds */ 72 | FOUNDATION_API tick_t 73 | time_system(void); 74 | -------------------------------------------------------------------------------- /foundation/tizen.c: -------------------------------------------------------------------------------- 1 | /* tizen.c - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #if FOUNDATION_PLATFORM_TIZEN 17 | 18 | static app_event_handler_h _event_handlers[5]; 19 | 20 | static bool 21 | _tizen_app_create(void* data) { 22 | FOUNDATION_UNUSED(data); 23 | return true; 24 | } 25 | 26 | static void 27 | _tizen_app_control(app_control_h control, void* data) { 28 | FOUNDATION_UNUSED(control); 29 | FOUNDATION_UNUSED(data); 30 | } 31 | 32 | static void 33 | _tizen_app_pause(void* data) { 34 | FOUNDATION_UNUSED(data); 35 | } 36 | 37 | static void 38 | _tizen_app_resume(void* data) { 39 | FOUNDATION_UNUSED(data); 40 | } 41 | 42 | static void 43 | _tizen_app_terminate(void* data) { 44 | FOUNDATION_UNUSED(data); 45 | } 46 | 47 | static void 48 | _tizen_app_lang_changed(app_event_info_h event_info, void* data) { 49 | FOUNDATION_UNUSED(event_info); 50 | FOUNDATION_UNUSED(data); 51 | } 52 | 53 | static void 54 | _tizen_app_orient_changed(app_event_info_h event_info, void* data) { 55 | FOUNDATION_UNUSED(event_info); 56 | FOUNDATION_UNUSED(data); 57 | } 58 | 59 | static void 60 | _tizen_app_region_changed(app_event_info_h event_info, void* data) { 61 | FOUNDATION_UNUSED(event_info); 62 | FOUNDATION_UNUSED(data); 63 | } 64 | 65 | static void 66 | _tizen_app_low_battery(app_event_info_h event_info, void* data) { 67 | FOUNDATION_UNUSED(event_info); 68 | FOUNDATION_UNUSED(data); 69 | } 70 | 71 | static void 72 | _tizen_app_low_memory(app_event_info_h event_info, void* data) { 73 | FOUNDATION_UNUSED(event_info); 74 | FOUNDATION_UNUSED(data); 75 | } 76 | 77 | int 78 | tizen_initialize(void) { 79 | ui_app_add_event_handler(&_event_handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, _tizen_app_low_battery, 0); 80 | ui_app_add_event_handler(&_event_handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, _tizen_app_low_memory, 0); 81 | ui_app_add_event_handler(&_event_handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], 82 | APP_EVENT_DEVICE_ORIENTATION_CHANGED, _tizen_app_orient_changed, 0); 83 | ui_app_add_event_handler(&_event_handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, 84 | _tizen_app_lang_changed, 0); 85 | ui_app_add_event_handler(&_event_handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, 86 | _tizen_app_region_changed, 0); 87 | return 0; 88 | } 89 | 90 | void 91 | tizen_finalize(void) { 92 | } 93 | 94 | void 95 | tizen_start_main_thread(void) { 96 | } 97 | 98 | int 99 | tizen_app_main(int argc, char** argv) { 100 | ui_app_lifecycle_callback_s event_callback; 101 | memset(&event_callback, 0, sizeof(event_callback)); 102 | event_callback.create = _tizen_app_create; 103 | event_callback.terminate = _tizen_app_terminate; 104 | event_callback.pause = _tizen_app_pause; 105 | event_callback.resume = _tizen_app_resume; 106 | event_callback.app_control = _tizen_app_control; 107 | return ui_app_main(argc, argv, &event_callback, 0); 108 | } 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /foundation/tizen.h: -------------------------------------------------------------------------------- 1 | /* tizen.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file tizen.h 16 | \brief Tizen platform safe header inclusion and entry points 17 | 18 | Tizen platform safe header inclusion and entry points */ 19 | 20 | #include 21 | 22 | #if FOUNDATION_PLATFORM_TIZEN 23 | 24 | #ifndef __error_t_defined 25 | #define __error_t_defined 1 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | /*! Initialize Tizen app 38 | \return 0 if success, <0 if error */ 39 | FOUNDATION_API int 40 | tizen_initialize(void); 41 | 42 | /*! Finalize Tizen app */ 43 | FOUNDATION_API void 44 | tizen_finalize(void); 45 | 46 | /*! Start main application thread */ 47 | FOUNDATION_API void 48 | tizen_start_main_thread(void); 49 | 50 | /*! Main entry point 51 | \param argc Argument count 52 | \param argb Argument array 53 | \return Application return code */ 54 | FOUNDATION_API int 55 | tizen_app_main(int argc, char** argv); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /foundation/uuidmap.h: -------------------------------------------------------------------------------- 1 | /* uuidmap.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file uuidmap.h 16 | \brief Simple container mapping UUID values to pointers 17 | 18 | Simple container mapping UUID values to pointers. Access is not atomic 19 | and therefor not thread safe. */ 20 | 21 | #include 22 | #include 23 | 24 | /*! Allocate new UUID map with the given bucket count and size. Minimum bucket 25 | count is 13, minimum bucket size is 8. UUID map should be deallocated with a call to 26 | #uuidmap_deallocate 27 | \param bucket_count Bucket count 28 | \param bucket_size Bucket size 29 | \return New UUID map */ 30 | FOUNDATION_API uuidmap_t* 31 | uuidmap_allocate(size_t bucket_count, size_t bucket_size); 32 | 33 | /*! Deallocate a UUID map previously allocated with #uuidmap_allocate 34 | \param map UUID map */ 35 | FOUNDATION_API void 36 | uuidmap_deallocate(uuidmap_t* map); 37 | 38 | /*! Initialize new UUID map with the given bucket count and size. Minimum bucket 39 | count is 13, minimum bucket size is 8. UUID map should be finalized with a call to 40 | #uuidmap_finalize 41 | \param map UUID map to initialize 42 | \param bucket_count Bucket count 43 | \param bucket_size Bucket size */ 44 | FOUNDATION_API void 45 | uuidmap_initialize(uuidmap_t* map, size_t bucket_count, size_t bucket_size); 46 | 47 | /*! Finalize a UUID map previously initialized with #uuidmap_initialize and free resources 48 | \param map UUID map */ 49 | FOUNDATION_API void 50 | uuidmap_finalize(uuidmap_t* map); 51 | 52 | /*! Insert a new key-value mapping. Will replace any previously stored mapping for the 53 | given key. 54 | \param map UUID map 55 | \param key Key 56 | \param value Value 57 | \return Previously stored value, 0 if no value previously stored for key */ 58 | FOUNDATION_API void* 59 | uuidmap_insert(uuidmap_t* map, uuid_t key, void* value); 60 | 61 | /*! Erase any value mapping for the given key. 62 | \param map UUID map 63 | \param key Key 64 | \return Previously stored value, 0 if no value previously stored for key */ 65 | FOUNDATION_API void* 66 | uuidmap_erase(uuidmap_t* map, uuid_t key); 67 | 68 | /*! Lookup the stored value mapping for the given key 69 | \param map UUID map 70 | \param key Key 71 | \return Stored value, 0 if no value stored for key */ 72 | FOUNDATION_API void* 73 | uuidmap_lookup(uuidmap_t* map, uuid_t key); 74 | 75 | /*! Query if there is any value mapping stored for the given key. 76 | \param map UUID map 77 | \param key Key 78 | \return true if there is a value mapping stored for the key, false if not */ 79 | FOUNDATION_API bool 80 | uuidmap_has_key(uuidmap_t* map, uuid_t key); 81 | 82 | /*! Get the number of key-value mappings stored in the UUID map. 83 | \param map UUID map 84 | \return Number of keys stored */ 85 | FOUNDATION_API size_t 86 | uuidmap_size(uuidmap_t* map); 87 | 88 | /*! Clear map and erase all key-value mappings. 89 | \param map UUID map */ 90 | FOUNDATION_API void 91 | uuidmap_clear(uuidmap_t* map); 92 | 93 | /*! Call function for each value in hashmap 94 | \param fn Function to call */ 95 | FOUNDATION_API void 96 | uuidmap_foreach(uuidmap_t* map, void (*fn)(void*, void*), void* context); 97 | -------------------------------------------------------------------------------- /foundation/version.h: -------------------------------------------------------------------------------- 1 | /* version.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file version.h 16 | \brief Version utilities 17 | 18 | Version utilities */ 19 | 20 | #include 21 | #include 22 | 23 | /*! Make version identifier from parts, packing into a 128-bit integer 24 | \param major Major version 25 | \param minor Minor version 26 | \param revision Revision number 27 | \param build Build number 28 | \param control Source control identifier 29 | \return Packet version definition */ 30 | static FOUNDATION_FORCEINLINE FOUNDATION_CONSTCALL version_t 31 | version_make(unsigned int major, unsigned int minor, unsigned int revision, unsigned int build, unsigned int control); 32 | 33 | // Implementation 34 | 35 | static FOUNDATION_FORCEINLINE FOUNDATION_CONSTCALL version_t 36 | version_make(unsigned int major, unsigned int minor, unsigned int revision, unsigned int build, unsigned int control) { 37 | version_t v; 38 | v.sub.major = (uint16_t)major; 39 | v.sub.minor = (uint16_t)minor; 40 | v.sub.revision = revision; 41 | v.sub.build = build; 42 | v.sub.control = control; 43 | return v; 44 | } 45 | -------------------------------------------------------------------------------- /foundation/windows.h: -------------------------------------------------------------------------------- 1 | /* windows.h - Foundation library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | /*! \file windows.h 16 | \brief Safe inclusion of windows.h 17 | 18 | Safe inclusion of windows.h without collisions with foundation library symbols. */ 19 | 20 | #include 21 | #include 22 | 23 | #if FOUNDATION_PLATFORM_WINDOWS 24 | 25 | #define STREAM_SEEK_END _STREAM_SEEK_END 26 | 27 | #undef UUID_DEFINED 28 | #undef UUID 29 | 30 | #define UUID_DEFINED 1 31 | #define UUID uint128_t 32 | 33 | #define WIN32_LEAN_AND_MEAN 34 | 35 | #if FOUNDATION_COMPILER_MSVC 36 | // Work around broken dbghlp.h header 37 | #pragma warning(disable : 4091) 38 | // Work around broken winbase.h header 39 | #pragma warning(disable : 5105) 40 | #elif FOUNDATION_COMPILER_CLANG 41 | #pragma clang diagnostic push 42 | #pragma clang diagnostic ignored "-Wnonportable-system-include-path" 43 | #endif 44 | 45 | #include 46 | 47 | #undef uuid_t 48 | #define clock_t clock_windows_t 49 | 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #undef min 63 | #undef max 64 | #undef STREAM_SEEK_END 65 | #undef UUID 66 | #undef uuid_t 67 | #undef clock_t 68 | 69 | #if FOUNDATION_COMPILER_CLANG 70 | #undef WINAPI 71 | #define WINAPI STDCALL 72 | #pragma clang diagnostic pop 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /options.lnt: -------------------------------------------------------------------------------- 1 | 2 | -d_WIN64 -d_LINT 3 | 4 | -A(C2011) 5 | 6 | +fie // We always use enums as integrals 7 | 8 | --emacro({438},va_end,va_copy,va_list) 9 | 10 | -e717 // We use do { ... } while(0) construct 11 | -e747 // We do not care about promotion of int constants (like 1) to unsigned long and similar (avoid having to write 1U everywhere) 12 | -e801 // We use goto to avoid function cleanup code duplication 13 | -e820 // We use while ((foo = bar())) style condensing to avoid while (1) { if (!foo) break; ... } constructs 14 | -e826 // We use struct "inheritance" and cast between structs of incompatible sizes 15 | -e835 // We give 0 as left argument to | operator (for example, MEMORY_PERSISTENT flag which is only for orthogonality to MEMORY_TEMPORARY) 16 | -e917 // We don't care about (for example) integer constants being coerced to unsigned int (passing 0 instead of 0U to a function taking unsigned int arg) 17 | -------------------------------------------------------------------------------- /test/all/android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /test/all/android/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /test/all/android/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /test/all/android/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /test/all/android/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /test/all/android/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /test/all/android/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/android/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /test/all/android/java/com/maniccoder/foundation/test/TestActivity.java: -------------------------------------------------------------------------------- 1 | package com.maniccoder.foundation.test; 2 | 3 | import android.os.Bundle; 4 | import android.app.NativeActivity; 5 | import android.graphics.Color; 6 | import android.graphics.Point; 7 | import android.widget.TextView; 8 | import android.util.Log; 9 | import android.widget.LinearLayout; 10 | import android.widget.PopupWindow; 11 | import android.view.View; 12 | import android.view.Gravity; 13 | import android.view.Display; 14 | import android.view.ViewGroup; 15 | import android.view.ViewGroup.LayoutParams; 16 | import android.view.ViewGroup.MarginLayoutParams; 17 | 18 | public class TestActivity extends NativeActivity 19 | { 20 | private TextView textView; 21 | private boolean displayedTextView = false; 22 | 23 | @Override 24 | public void onWindowFocusChanged(boolean hasFocus) { 25 | super.onWindowFocusChanged(hasFocus); 26 | 27 | if (!displayedTextView && hasFocus) { 28 | displayedTextView = true; 29 | 30 | setContentView(R.layout.main); 31 | 32 | textView = (TextView)findViewById(R.id.logtext); 33 | textView.setText(""); 34 | textView.setOnClickListener(new View.OnClickListener() { 35 | @Override 36 | public void onClick(View v) {} 37 | }); 38 | textView.setOnLongClickListener(new View.OnLongClickListener() { 39 | @Override 40 | public boolean onLongClick(View v) { return true; } 41 | }); 42 | ((ViewGroup)textView.getParent()).removeView(textView); 43 | 44 | final TestActivity activity = this; 45 | 46 | runOnUiThread(new Runnable() { 47 | @Override 48 | public void run() { 49 | PopupWindow popup = new PopupWindow(activity); 50 | 51 | Display display = getWindowManager().getDefaultDisplay(); 52 | Point size = new Point(); 53 | display.getSize(size); 54 | 55 | popup.setWidth(size.x); 56 | popup.setHeight(size.y); 57 | popup.setWindowLayoutMode(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 58 | popup.setClippingEnabled(false); 59 | 60 | MarginLayoutParams params = new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 61 | params.setMargins(0, 0, 0, 0); 62 | 63 | LinearLayout layout = new LinearLayout(activity); 64 | layout.setOrientation(LinearLayout.VERTICAL); 65 | layout.addView(activity.textView, params); 66 | 67 | popup.setContentView(layout); 68 | 69 | final ViewGroup viewGroup = (ViewGroup)((ViewGroup)activity.findViewById(android.R.id.content)).getChildAt(0); 70 | 71 | popup.showAtLocation(viewGroup, Gravity.TOP, 0, 0); 72 | popup.update(); 73 | } 74 | }); 75 | } 76 | } 77 | 78 | public void appendLog( final String msg ) 79 | { 80 | runOnUiThread(new Runnable() { 81 | @Override 82 | public void run() { 83 | if (textView != null) 84 | textView.append(msg); 85 | } 86 | }); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /test/all/android/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/all/android/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Foundation Test Suite 4 | 5 | -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon_29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon_58.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "icon_80-1.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "57x57", 23 | "idiom" : "iphone", 24 | "filename" : "icon_57.png", 25 | "scale" : "1x" 26 | }, 27 | { 28 | "size" : "57x57", 29 | "idiom" : "iphone", 30 | "filename" : "icon_114.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "icon_120.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon_180.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "icon_29-1.png", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "size" : "29x29", 53 | "idiom" : "ipad", 54 | "filename" : "icon_58-1.png", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "icon_40.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "40x40", 65 | "idiom" : "ipad", 66 | "filename" : "icon_80.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "50x50", 71 | "idiom" : "ipad", 72 | "filename" : "icon_50.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "50x50", 77 | "idiom" : "ipad", 78 | "filename" : "icon_100.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "72x72", 83 | "idiom" : "ipad", 84 | "filename" : "icon_72.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "72x72", 89 | "idiom" : "ipad", 90 | "filename" : "icon_144.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "icon_76.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "icon_152.png", 103 | "scale" : "2x" 104 | } 105 | ], 106 | "info" : { 107 | "version" : 1, 108 | "author" : "xcode" 109 | } 110 | } -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_100.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_114.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_120.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_144.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_152.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_180.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_29-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_29-1.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_29.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_40.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_50.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_57.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_58-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_58-1.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_58.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_72.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_76.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_80-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_80-1.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/AppIcon.appiconset/icon_80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/AppIcon.appiconset/icon_80.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "filename" : "launch_640_960.png", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "extent" : "full-screen", 13 | "idiom" : "iphone", 14 | "subtype" : "retina4", 15 | "filename" : "launch_640_1136.png", 16 | "minimum-system-version" : "7.0", 17 | "orientation" : "portrait", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "orientation" : "portrait", 22 | "idiom" : "ipad", 23 | "extent" : "full-screen", 24 | "minimum-system-version" : "7.0", 25 | "filename" : "launch_768_1024.png", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "orientation" : "landscape", 30 | "idiom" : "ipad", 31 | "extent" : "full-screen", 32 | "minimum-system-version" : "7.0", 33 | "filename" : "launch_1024_768.png", 34 | "scale" : "1x" 35 | }, 36 | { 37 | "orientation" : "portrait", 38 | "idiom" : "ipad", 39 | "extent" : "full-screen", 40 | "minimum-system-version" : "7.0", 41 | "filename" : "launch_1536_2048.png", 42 | "scale" : "2x" 43 | }, 44 | { 45 | "orientation" : "landscape", 46 | "idiom" : "ipad", 47 | "extent" : "full-screen", 48 | "minimum-system-version" : "7.0", 49 | "filename" : "launch_2048_1536.png", 50 | "scale" : "2x" 51 | }, 52 | { 53 | "orientation" : "portrait", 54 | "idiom" : "iphone", 55 | "extent" : "full-screen", 56 | "filename" : "launch_320_480.png", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "portrait", 61 | "idiom" : "iphone", 62 | "extent" : "full-screen", 63 | "filename" : "launch_640_960.png", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "orientation" : "portrait", 68 | "idiom" : "iphone", 69 | "extent" : "full-screen", 70 | "filename" : "launch_640_1136.png", 71 | "subtype" : "retina4", 72 | "scale" : "2x" 73 | }, 74 | { 75 | "orientation" : "portrait", 76 | "idiom" : "ipad", 77 | "extent" : "to-status-bar", 78 | "filename" : "launch_768_1004.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "orientation" : "landscape", 83 | "idiom" : "ipad", 84 | "extent" : "to-status-bar", 85 | "filename" : "launch_1024_748.png", 86 | "scale" : "1x" 87 | }, 88 | { 89 | "orientation" : "portrait", 90 | "idiom" : "ipad", 91 | "extent" : "to-status-bar", 92 | "filename" : "launch_1536_2008.png", 93 | "scale" : "2x" 94 | }, 95 | { 96 | "orientation" : "landscape", 97 | "idiom" : "ipad", 98 | "extent" : "to-status-bar", 99 | "filename" : "launch_2048_1496.png", 100 | "scale" : "2x" 101 | } 102 | ], 103 | "info" : { 104 | "version" : 1, 105 | "author" : "xcode" 106 | } 107 | } -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1024_748.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1024_748.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1024_768.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1024_768.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1536_2008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1536_2008.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1536_2048.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_1536_2048.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_2048_1496.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_2048_1496.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_2048_1536.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_2048_1536.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_320_480.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_320_480.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_640_1136.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_640_1136.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_640_960.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_640_960.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_768_1004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_768_1004.png -------------------------------------------------------------------------------- /test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_768_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/ios/Images.xcassets/LaunchImage.launchimage/launch_768_1024.png -------------------------------------------------------------------------------- /test/all/ios/test-all.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | Foundation 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | TEST 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSMainNibFile 26 | test-all 27 | NSMainNibFile~ipad 28 | test-all 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarHidden 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | UIInterfaceOrientationPortraitUpsideDown 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /test/all/ios/test-all.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/all/ios/viewcontroller.h: -------------------------------------------------------------------------------- 1 | /* viewcontroller.h - Foundation test launcher - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #pragma once 14 | 15 | #include 16 | #include 17 | 18 | #ifdef __OBJC__ 19 | 20 | @interface ViewController : UIViewController { 21 | @public 22 | } 23 | @end 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /test/all/ios/viewcontroller.m: -------------------------------------------------------------------------------- 1 | /* viewcontroller.m - Foundation test launcher - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include "viewcontroller.h" 14 | 15 | #if FOUNDATION_COMPILER_CLANG 16 | # if __has_warning("-Wpartial-availability") 17 | # pragma clang diagnostic ignored "-Wpartial-availability" 18 | # endif 19 | #endif 20 | 21 | @interface ViewController() 22 | @end 23 | 24 | @implementation ViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) 30 | [self setNeedsStatusBarAppearanceUpdate]; 31 | //iOS pre-9.0 - else 32 | // [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; 33 | } 34 | 35 | - (void)didReceiveMemoryWarning { 36 | [super didReceiveMemoryWarning]; 37 | } 38 | 39 | - (BOOL)prefersStatusBarHidden { 40 | return TRUE; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /test/all/tizen/res/tizenapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjansson/foundation_lib/3817fa9a616806f0e093d2c2134e00fc7e2b81c6/test/all/tizen/res/tizenapp.png -------------------------------------------------------------------------------- /test/all/tizen/tizen-manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tizenapp.png 6 | 7 | 8 | 9 | http://tizen.org/privilege/systemsettings 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/coverage.py: -------------------------------------------------------------------------------- 1 | 2 | import re 3 | 4 | def parse_gcov( gcovfile ): 5 | """Parses a .gcov file and returns a report array of line coverage 6 | """ 7 | 8 | report = [] 9 | ignore_block = False 10 | 11 | with open( gcovfile ) as gcov: 12 | for line in gcov: 13 | tokens = line.split(':') 14 | if len(tokens) < 2: 15 | continue 16 | 17 | count = tokens[0].strip() 18 | line = int( tokens[1].strip() ) 19 | source = tokens[2] 20 | 21 | if line == 0: 22 | continue 23 | 24 | if re.search( r'\bLCOV_EXCL_START\b', source ): 25 | ignore_block = ignore_block + 1 26 | elif re.search(r'\bLCOV_EXCL_END\b', source ): 27 | ignore_block = ignore_block - 1 28 | 29 | if count == '-': 30 | report.append( None ) 31 | elif count == '#####': 32 | if ( ignore_block > 0 or 33 | source.strip().startswith( ( 'inline', 'static' ) ) or 34 | source.strip() == '}' or 35 | re.search( r'\bLCOV_EXCL_LINE\b', source ) ): 36 | report.append( None ) 37 | else: 38 | report.append( 0 ) 39 | elif count == '=====': 40 | report.append( 0 ) 41 | else: 42 | report.append( int( count ) ) 43 | return report 44 | -------------------------------------------------------------------------------- /test/mock/mock.h: -------------------------------------------------------------------------------- 1 | /* test.c - Foundation test library - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | 15 | #if FOUNDATION_PLATFORM_POSIX 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | void 25 | mmap_mock(void* return_value, int err); 26 | 27 | void 28 | mmap_unmock(void); 29 | 30 | void 31 | munmap_mock(int return_value, int err); 32 | 33 | void 34 | munmap_unmock(void); 35 | 36 | void 37 | fork_mock(pid_t return_value, int err); 38 | 39 | void 40 | fork_unmock(void); 41 | 42 | void 43 | waitpid_mock(pid_t return_value, int err); 44 | 45 | void 46 | waitpid_unmock(void); 47 | 48 | void 49 | execv_mock(int return_value, int err); 50 | 51 | void 52 | execv_unmock(void); 53 | 54 | void 55 | dup2_mock(int return_value, int err); 56 | 57 | void 58 | dup2_unmock(void); 59 | 60 | #if !FOUNDATION_PLATFORM_APPLE 61 | 62 | void 63 | sem_init_mock(int return_value, int err); 64 | 65 | void 66 | sem_init_unmock(void); 67 | 68 | #endif 69 | 70 | #if !FOUNDATION_PLATFORM_IOS 71 | 72 | void 73 | sem_open_mock(sem_t* return_value, int err); 74 | 75 | void 76 | sem_open_unmock(void); 77 | 78 | #endif 79 | 80 | #if FOUNDATION_PLATFORM_APPLE 81 | 82 | void 83 | dispatch_semaphore_create_mock(dispatch_semaphore_t return_value, int err); 84 | 85 | void 86 | dispatch_semaphore_create_unmock(void); 87 | 88 | #endif 89 | 90 | void 91 | exit_mock(jmp_buf target); 92 | 93 | void 94 | exit_unmock(void); 95 | 96 | #elif FOUNDATION_PLATFORM_WINDOWS 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /test/test/test.m: -------------------------------------------------------------------------------- 1 | /* test.m - Foundation test library - Public Domain - 2014 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support 4 | * data types and functions to write applications and games in a platform-independent fashion. 5 | * The latest source code is always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without 10 | * any restrictions. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | #if FOUNDATION_PLATFORM_IOS 19 | 20 | # import 21 | 22 | void 23 | test_text_view_append(void* window, int tag, const char* msg, size_t length) { 24 | if (!window || !msg || !length) 25 | return; 26 | 27 | __strong UITextView* textview = (UITextView*)[(__bridge UIWindow*)window viewWithTag:tag]; 28 | if (!textview) 29 | return; 30 | 31 | @autoreleasepool { 32 | NSString* nsmsg = [NSString stringWithUTF8String:msg]; 33 | dispatch_async(dispatch_get_main_queue(), ^ { @autoreleasepool { 34 | textview.text = [textview.text stringByAppendingString:nsmsg]; 35 | } 36 | }); 37 | } 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tools/bin2hex/errorcodes.h: -------------------------------------------------------------------------------- 1 | /* errorcodes.h - Foundation bin2hex tool - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support data types and 4 | * functions to write applications and games in a platform-independent fashion. The latest source code is 5 | * always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. 10 | * 11 | */ 12 | 13 | // Error codes returned by bin2hex tool 14 | #define BIN2HEX_RESULT_OK 0 15 | #define BIN2HEX_RESULT_MISSING_INPUT_FILE -1 16 | #define BIN2HEX_RESULT_UNABLE_TO_OPEN_OUTPUT_FILE -2 17 | -------------------------------------------------------------------------------- /tools/hashify/errorcodes.h: -------------------------------------------------------------------------------- 1 | /* errorcodes.h - Foundation library tools - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support data types and 4 | * functions to write applications and games in a platform-independent fashion. The latest source code is 5 | * always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. 10 | * 11 | */ 12 | 13 | // Error codes returned by hashify tool 14 | #define HASHIFY_RESULT_OK 0 15 | #define HASHIFY_RESULT_MISSING_INPUT_FILE -1 16 | #define HASHIFY_RESULT_MISSING_OUTPUT_FILE -2 17 | #define HASHIFY_RESULT_OUTPUT_FILE_OUT_OF_DATE -3 18 | #define HASHIFY_RESULT_HASH_STRING_MISMATCH -4 19 | #define HASHIFY_RESULT_HASH_MISMATCH -5 20 | #define HASHIFY_RESULT_HASH_MISSING -6 21 | #define HASHIFY_RESULT_HASH_COLLISION -7 22 | #define HASHIFY_RESULT_STRING_COLLISION -8 23 | #define HASHIFY_RESULT_EXTRA_STRING -9 24 | #define HASHIFY_RESULT_OUTPUT_FILE_WRITE_FAIL -10 25 | -------------------------------------------------------------------------------- /tools/uuidgen/errorcodes.h: -------------------------------------------------------------------------------- 1 | /* errorcodes.h - Foundation library tools - Public Domain - 2013 Mattias Jansson 2 | * 3 | * This library provides a cross-platform foundation library in C11 providing basic support data types and 4 | * functions to write applications and games in a platform-independent fashion. The latest source code is 5 | * always available at 6 | * 7 | * https://github.com/mjansson/foundation_lib 8 | * 9 | * This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. 10 | * 11 | */ 12 | 13 | // Error codes returned by uuidgen tool 14 | #define UUIDGEN_RESULT_OK 0 15 | #define UUIDGEN_INVALID_ARGUMENT -1 16 | #define UUIDGEN_RESULT_UNKNOWN_METHOD -2 17 | #define UUIDGEN_RESULT_UNABLE_TO_OPEN_OUTPUT_FILE -3 18 | --------------------------------------------------------------------------------