nlib
|
This manual is a collection of libraries that support Windows, Linux, FreeBSD, OS X, Cygwin, and Nintendo's development environments.
nlib
is being developed to provide a group of user-space libraries that enable you to program for Windows, Linux, FreeBSD OS X, Cygwin, and Nintendo's development environments using the same interface. Its development follows a software-centric approach, adopts appropriate and pragmatic coding rules (nlib Coding Rules
), and implements an interface that is independent from the individual development environments. This focus makes it possible to develop in parallel for multiple development environments while maintaining high quality, performance, and reliability.Platform | Library types | Remarks | ||
---|---|---|---|---|
Windows | Visual Studio 2015 | 64bit | static library, DLL | Update 3 |
32bit | static library | |||
Visual Studio 2013 | 64bit | static library, DLL | Update 5, Express Edition is available | |
32bit | static library | |||
Visual Studio 2012 | 64bit | static library, DLL | Update 5, Express Edition is available | |
32bit | static library | |||
Cygwin | 64bit | static library | gcc 5.4.0, newlib, libstdc++ | |
Bash on Ubuntu on Windows | 64bit | shared library | gcc 4.8.4, clang 3.4, glibc, libstdc++ | |
Linux | Ubuntu 16.04 LTS | 64bit | shared library | gcc 5.3.1, clang 3.8, glibc, libstdc++, https://atlas.hashicorp.com/ubuntu/ |
Ubuntu 14.04 LTS | 64bit | gcc 4.8.4, clang 3.4, glibc, libstdc++, https://atlas.hashicorp.com/ubuntu/ | ||
32bit | ||||
CentOS 7 (v1608.01) | 64bit | gcc 4.8.5, glibc, libstdc++, https://atlas.hashicorp.com/centos/ | ||
Fedora 24 | 64bit | gcc 6.1.1, clang 3.8, glibc, libstdc++. https://atlas.hashicorp.com/fedora/ | ||
Alpine 3.4.0 | 64bit | gcc 5.3.0, musl libc, libstdc++, https://atlas.hashicorp.com/maier | ||
FreeBSD | FreeBSD 11.0 | 64bit | shared library | clang 3.8, BSD libc, libc++, https://atlas.hashicorp.com/freebsd |
OS X | OS X 10.11 (El Capitan) | 64bit | shared library | Xcode 8.0 |
CTR | CTR-SDK 11.5 | 32bit | static library | CTR_SDK-11_5_1-20160622-ja.zip armcc_4_1_nintendo-b1454-20150227.zip |
Cafe | CafeSDK 2.13.01 | 32bit | static library | cafe_sdk-2_13_01-20150728.zip MULTI-5_3_26-20150918.zip |
nlib
. It is a good idea to use the testing
library to create these types of acceptance tests. nn::nlib::testing
format and include it in your bug report.├── bin │ └── cmake # Command-line tools ├── cmake # Common Cmake scripts ├── documents-en │ └── API # Reference Manual │ ├── html # HTML version of the Reference Manual │ └── searchdata.xml # Search index ├── include # Include files (in `system/include` for Cafe) │ ├── nn │ │ └── nlib │ │ ├── exi │ │ ├── heap │ │ ├── msgpack │ │ │ └── jsonrpc │ │ ├── oss │ │ ├── simd │ │ ├── succinct │ │ ├── testing │ │ ├── threading │ │ └── unicode │ ├── lz4.h │ ├── lz4hc.h │ ├── lz4frame.h │ ├── sqlite3.h │ └── sqlite3ext.h ├── lib # Platform-specific library files (`system/lib` for Cafe, `libraries` for CTR) ├── samples # Source code for samples │ ├── cmake │ └── sources │ ├── exi │ ├── heap │ ├── misc │ ├── msgpack │ ├── oss │ ├── succinct │ └── testing └── setup ├── nlib.natvis ├── setup-bash-ubuntu-windows-tools.sh ├── setup-cygwin-tools.sh └── setup-msvc-libraries.sh └── setup-vagrant-plugins.sh
\par <tt>libn</tt> Library (including <tt>libn.a, libn.so, n-vc120amd64.lib, and n-vc120dllamd64.dll</tt>, etc.) This library includes functions that have C linkages for suppressing differences among various platforms. \par Specifically, the following functions are provided: <ul> <li> Functions, including <tt>nlib_epochtime()</tt>, that obtain the current time. <li> The <tt>nlib_gen_random()</tt> function that obtains random values. <li> Allocation and deallocation of (virtual) memory from the operating system <li> Functions and macros supporting pthread <ul> <li> Threads (\ref nlib_thread) and functions that start a thread or merge threads. <li> Mutexes (<tt>\ref nlib_mutex</tt>) <li> Conditional variables (<tt>\ref nlib_cond</tt>) <li> TLS (<tt>\ref nlib_tls</tt>) <li> Barriers (<tt>\ref nlib_barrier</tt>) <li> One-time execution (<tt>nlib_once()</tt>, <tt>nlib_tryonce()</tt>) <li> Read-write lock (<tt>\ref nlib_rwlock</tt>) <li> Conditional variables for read-write lock (<tt>\ref nlib_condrwlock</tt>) </ul> <li> Message queues supporting lock-free behavior (<tt>\ref nlib_mq</tt>) <li> Functions, including <tt>nlib_atomic_compare_exchange32()</tt>, that atomically rewrite memory. <li> Functions, including <tt>nlib_debug_break()</tt> and <tt>nlib_debug_backtrace()</tt>, that access the debugger. <li> The <tt>nlib_getenv()</tt> function that obtains environment variable values. <li> File handles and file I/O functionality, including <tt>nlib_fd_open()</tt>. <li> Functions relating to string searches, accelerated with SIMD. <li> String encoding conversion between UTF-8 and UTF-16 and between UTF-8 and UTF-32, in both directions <li> Functions, including <tt>nlib_strto_int32()</tt>, that wrap standard C functions, including <tt>strtol()</tt> and <tt>strtoll()</tt>, in a way they are not wrongly used. <li> Functions, including <tt>nlib_isspace()</tt>, that implement standard C functions defined by <tt>ctype.h</tt> in a way they are not affected by the locale. <li> Functions, including <tt>nlib_snprintf()</tt>, that are adjusted to suppress differences among the environment-specific behaviors of <tt>snprintf()</tt>, <tt>snwprintf()</tt>, and other similar functions to prevent them from being wrongly used. <li> Fast conversion of endianness (including <tt>nlib_swapendian_32()</tt>) <li> Fast CRC32 and CRC32C calculations (<tt>nlib_crc32()</tt> and <tt>nlib_crc32c()</tt>) <li> Fast pop count calculations (including <tt>nlib_popcnt64()</tt>) <li> Macros that absorb differences among the various attributes for each compiler </ul> \par misc Library (libnx_misc.a, libnx_misc.so, nx_misc-vc120amd64.lib, nx_misc-vc120dllamd64.dll, etc.) This library is a class library that includes relatively small classes. It implements many features that are believed to be commonly used in programs. \par Specifically, it includes the following. <ul> <li> Base stream classes that serve as a foundation for <tt>InputStream</tt> and <tt>OutputStream</tt> <ul> <li> Reading and writing data to memory (<tt>\ref MemoryInputStream</tt> and <tt>\ref MemoryOutputStream</tt>) <li> Reading and writing files (<tt>\ref FileInputStream</tt> and <tt>\ref FileOutputStream</tt>) <li> Reading and writing Base64-encoded data (<tt>\ref Base64InputStream</tt> and <tt>\ref Base64OutputStream</tt>) <li> Reading and writing <tt>zlib</tt>-compressed data (<tt>\ref ZlibInputStream</tt> and <tt>\ref ZlibOutputStream</tt>) </ul> <li> Classes that read and write UTF-8 strings from streams while validating (<tt>\ref TextReader</tt> and <tt>\ref TextWriter</tt>) <li> Classes that read and write binary data from streams (<tt>\ref BinaryReader</tt> and <tt>\ref BinaryWriter</tt>) <li> Classes for handling Unicode <ul> <li> Classes for Unicode string normalization (NFC, NFD, NFKC, NFKD) (<tt>\ref unicode::UnicodeNormalizer</tt>) <li> Tables for RFC 3454 (<tt>\ref unicode::StringPrep</tt>) </ul> <li> Classes and functions for handling threads <ul> <li> A wrapper class of types and functions defined in the <tt>libn</tt> library. <li> A class corresponding to <tt>std::thread</tt> that runs without C++03 or C++ exceptions (<tt>\ref threading::Thread</tt>) <li> Classes and functions corresponding to <tt>std::future</tt> and <tt>std::async</tt> that run without C++03 or C++ exceptions (<tt>\ref threading::Future</tt> and <tt>\ref threading::Async</tt>) <li> Thread pools (<tt>\ref threading::ThreadPool</tt>) </ul> <li> Classes and functions for handling date and time information <ul> <li> Classes for adding and subtracting dates and times, in addition to parsing and creating RFC 2822 or W3C DTF date strings (<tt>\ref DateTime</tt> and <tt>\ref TimeSpan</tt>) </ul> <li> Classes and functions for handling URIs <ul> <li> URI parsers (<tt>\ref Uri</tt>) <li> Classes for processing RFC 6570 URI templates (<tt>\ref UriTemplate</tt>) <li> A class for standardizing file paths, which are often represented by different strings depending on the environment, into URI strings (<tt>\ref NativePathMapper</tt>). </ul> <li> A class for handling asynchronous file access (<tt>\ref threading::AsyncFileIo</tt>) <li> Basic lock-free data structure and the algorithm <ul> <li> A function, including <tt>LockFreeInit()</tt>, for initializing lock-free objects. <li> A lock-free pipe (<tt>LockFreePipe</tt>) that can be used when one sender thread is associated with only one receiver thread. <li> A lock-free stack (<tt>LockFreeStack</tt>) <li> A lock-free queue (<tt>LockFreeQueue</tt>) <li> A lock-free queue with a priority set (<tt>LockFreePriorityQueue</tt>) <li> A lock-free broadcast queue (<tt>LockFreeBroadcastQueue</tt>) </ul> <li> The different types of gadget classes <ul> <li> A substitute class for <tt>std::unique_ptr</tt> (<tt>\ref UniquePtr</tt>). In C++11, this class is defined as <tt>std::unique_ptr</tt> using a <tt>typedef</tt>. <li> %Singleton classes (<tt>\ref Singleton</tt> and <tt>\ref SimpleSingleton</tt>) <li> An <tt>std::vector</tt>-like class that does not require freeing memory and copying elements upon expansion (<tt>\ref Nlist</tt>) <li> A class for parsing command-line strings (<tt>\ref Nflags</tt>) <li> A class for supporting handle creation (<tt>\ref HandleMaker</tt>) </ul> </ul> The namespaces include <tt>nn::nlib</tt>, <tt>nn::nlib::unicode</tt>, and <tt>nn::nlib::threading</tt>. \par exi Library (libnx_exi.a, libnx_exi.so, nx_exi-vc120amd64.lib, nx_exi-vc120dllamd64.dll, etc.) A library used to read and write binary XML. It can also read and write text-based XML. It supports XML namespaces and includes a simple, easily programmable pull parsing API. \n The namespace is <tt>nn::nlib::exi</tt>. \par heap Library (libnx_heap.a, libnx_heap.so, nx_heap.lib, nx_heap-vc120dllamd64.dll, etc.) This library is a heap library for which memory allocation and deallocation is optimized with multithreaded operations. The <tt>nmalloc</tt> and <tt>nfree</tt> functions (and the <tt>heap::CachedHeap</tt> and <tt>heap::CentralHeap</tt> classes used to implement them) keep performance degradation in check by controlling fragmentation through the use of multi-level free lists. By maintaining per-thread caches for small blocks of memory, memory can be allocated and freed without locking, which helps to limit the degradation of multithreaded performance. Pointers within the free lists are checked for both mangling and their allocation status. This implementation makes it more difficult to use them in an invalid way by overwriting memory externally. \n The namespaces are <tt>nn::nlib::heap</tt> and the global namespace (C linkage functions). \par succinct Library (libnx_succinct.a, libnx_succinct.so, nx_succinct-vc120amd64.lib, nx_succinct-vc120dllamd64.dll, etc.) A library used to handle succinct data structures. You can think of a succinct data structure as one whose content can be searched while it is still compressed. \n The <tt>succinct</tt> library includes the following. <ul> <li> Implementation of succinct vector classes <li> A class that implements balanced parentheses <li> A class that implements LOUDS (level-order unary degree sequences) <li> Trie implementation <li> A class for creating high-compression indices and searching strings using the Aho–Corasick algorithm </ul> The namespace is <tt>nn::nlib::succinct</tt>. \par msgpack Library (libnx_msgpack.a, libnx_msgpack.so, nx_msgpack-vc120amd64.lib, nx_msgpack-vc120dllamd64.dll, etc.) A library for reading and writing <a href="http://msgpack.org/">MessagePack</a> and JSON. It also includes a class for parsing CSV. \n The <tt>msgpack</tt> library includes the following. <ul> <li> Classes for reading and writing JSON from streams <li> Classes for reading and writing MessagePack from streams <li> A class for high-speed in-memory MessagePack parsing <li> A class for reading CSV <li> Classes for storing JSON, MessagePack, and CSV data after it has been read <li> Implementation of JSON-RPC </ul> The namespace is <tt>nn::nlib::msgpack</tt>. \par testing Library (libnx_testing.a, libnx_testing.so, nx_testing-vc120amd64.lib, nx_testing-vc120dllamd64.dll, etc.) A library for writing highly portable test code. It is a testing framework that is somewhat source-code compatible with tests written for <a href="https://code.google.com/p/googletest/">Google Test</a>. \n The namespace is <tt>nn::nlib::testing</tt>. (It is aliased to the <tt>testing</tt> namespace for the sake of Google Test compatibility.) It depends on the <tt>misc</tt> library. \par oss Library (libnx_oss_bsdiff.a, libnx_oss_sqlite3.a, libnx_oss_lz4.a, etc) Contains code for open-source software (OSS), code derived from OSS, and code for accessing OSS. To use it, an OSS license must be processed. \n The following libraries are currently included. They are built as separate library files. <ul> <li> A library conversion of <a href="http://www.daemonology.net/bsdiff/">bsdiff</a> that has been modified to use <tt>zlib</tt> instead of <tt>bzlib2</tt>, and the corresponding command-line programs <li> A version of <a href="https://www.sqlite.org/">SQLite3</a> that has been modified to run using the interfaces provided by <tt>nlib</tt>, and a corresponding command-line shell <li> <a href="https://github.com/Cyan4973/lz4">LZ4</a> is approximately 20 times faster at data compression than <tt>zlib</tt>, and approximately five times faster at decompression. </ul> \par The namespaces are <tt>nn::nlib::oss</tt> and the global namespace (C linkage functions). \par simd Library (Mostly Inline Functions Included in the misc Library) SIMD instructions can significantly increase the speed of programs. The <tt>simd</tt> library makes it possible to write code that supports both SSE4.2 and NEON. \n It supports integer and single-precision floating-point number calculations that enable your code to compute at high speeds. \n Single-precision floating-point number calculation can be used even in environments that do not support SSE or NEON. \n On Cafe, this is optimized to use paired singles. \par In other words, the same code can support the following environments. <ul> <li> On x86 processors, the code is compiled with speed boosts through the use of SSE 4.2. <li> On processors with NEON support, the code is compiled with speed boosts through the use of NEON. <li> On Cafe, the code is compiled with speed boosts through the use of paired singles. (Floating-point operations alone are quite a bit slower than the Cafe-SDK for operations like matrix calculations, because the interface returns values for data like four-dimensional vectors.) <li> On CTR, generic code is compiled (floating-point operations only). </ul> The namespace is <tt>nn::nlib::simd</tt>.
The dependency between nlib
libraries is as shown in the following figure.
nlib
is compiled using C++11 features for some combinations of compilers and versions. The table below summarizes the C++11 features, compatibility macros that can be used with nlib
, and the compilers that compile using C++11. Note that for clang
, the determination is made based on __has_feature
and __has_include
macros, and not the version. C++11 Feature | Identification Macro | Macros and Typedefs for C++03 Compatibility | Visual Studio | gcc |
---|---|---|---|---|
Rvalue references | NLIB_CXX11_RVALUE_REFERENCES | None | 2010 | 4.3 |
Variadic templates | NLIB_CXX11_VARIADIC_TEMPLATES | None | 2013 | 4.7 |
Static assertions | NLIB_CXX11_STATIC_ASSERTIONS | NLIB_STATIC_ASSERT() | 2010 | 4.3 |
Null pointer constant | NLIB_CXX11_NULL_POINTER_CONSTANT | nn::nlib::nullptr, nn::nlib::nullptr_t | 2010 | 4.6 |
Deleted functions | NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS | NLIB_DISALLOW_COPY_AND_ASSIGN() | 2015 | 4.4 |
Explicit conversion operators | NLIB_CXX11_EXPLICIT_CONVERSION_OPERATORS | NLIB_SAFE_BOOL() | 2013 | 4.6 |
Alias templates | NLIB_CXX11_TEMPLATE_ALIAS | None | 2013 | 4.7 |
constexpr | NLIB_CXX11_CONSTEXPR | NLIB_CEXPR | 2015 | 4.7 |
char16_t, char32_t | NLIB_CXX11_NEW_CHARACTER_TYPES | nlib_utf16_t, nlib_utf32_t | 2015 | 4.4 |
alignas | NLIB_CXX11_ALIGNMENT_SUPPORT | NLIB_ALIGNAS() | 2015 | 4.8 |
Explicit virtual overrides | NLIB_CXX11_EXPLICIT_VIRTUAL_OVERRIDES | NLIB_OVERRIDE | 2012 | 4.7 |
final | NLIB_CXX11_EXPLICIT_VIRTUAL_OVERRIDES | NLIB_FINAL | 2012 | 4.7 |
noexcept | NLIB_CXX11_NOEXCEPT | NLIB_NOEXCEPT | 2015 | 4.6 |
Range-based for | NLIB_CXX11_RANGE_BASED_FOR | None | 2012 | 4.6 |
lambda | NLIB_CXX11_LAMBDAS | None | 2012 | 4.7 |
Delegating constructors | NLIB_CXX11_DELEGATING_CONSTRUCTORS | None | 2013 | 4.7 |
std::unique_ptr | NLIB_CXX11_UNIQUEPTR | nn::nlib::UniquePtr | 2013 | 4.7 |
#include <random> | NLIB_CXX11_STDLIB_RANDOM | None | 2013 | 4.8 |
#include <chrono> | NLIB_CXX11_STDLIB_CHRONO | Conversion to and from nn::nlib::DateTime | 2012 | 4.7 |
#include <atomic> | NLIB_CXX11_STDLIB_ATOMIC | NLIB_MEMORY_ORDER_SEQ_CST and others | 2012 | 4.8 |
#include <array> | NLIB_CXX11_STDLIB_ARRAY | None | 2012 | 4.5 |
#include <unordered_map> #include <unordered_set> | NLIB_CXX11_STDLIB_UNORDERED | None | 2012 | 4.5 |
#include <tuple> | NLIB_CXX11_STDLIB_TUPLE | None | 2012 | 4.5 |
nlib
coding rules are a slight modification and relaxation of the latest version of the Google C++ Style Guide (and a slightly outdated Japanese translation). nlib
are shown below. Coding rule | Google C++ Style Guide | nlib |
---|---|---|
Line length | 80 | 100 |
Indentation | 2 | 4 |
Parameter order | Inputs followed by outputs | Outputs followed by inputs |
Default argument | Prohibited in principle | Allowed for use except for the cases described below:
|
File name | file_name.cc | FileName.cpp(file_name.cpp in the sample) |
#include guard | Also append #pragma once (for accelerating compilation in Visual Studio) | |
Use of boost | Not to be used by libraries (may be used for other purposes such as testing) | |
Accessor function name | get_xyz() / set_xyz() | GetXyz() / SetXyz() |
Argument passed by reference | Non-const references are prohibited | In nlib , non-cost references are allowed as exceptions in the following cases.
|
Use of C++11 | Ensure that headers and source code can be properly compiled also by using C++03 compilers.
| |
nullptr | Use if C++11 | In principle, don't use nullptr_t or nullptr as long as C++03 is used.
|
constexpr | Use if C++11 | For the time being, use of constexpr should be avoided except in obvious cases.
|
Comment |
|
--linelength=100
to allow up to 100 characters per line. cpplint
's legal/copyright
, build/include_alpha
, and whitespace/newline
categories have been suppressed. algorithm
header are not required when using std::swap
. nlib
supports checking source code using clang-check
. Generating a makefile with CMake creates a file called compile_commands.json
, which clang-check
uses to run. clang
manual.clang-format
to standardize the indentation and other stylistic aspects to suit your preferences. You can use the configuration used by nlib
, which is stored in a .clang-format
file (for clang
3.5) that is included in the nlib
package. It is recommended that you first convert your source code en masse using clang-format
, and then use cpplint.py
to do common detailed checks.pragma
warnings is permitted. _MSC_FULL_VER
in your code. gcc
and clang
binary packages available for Cygwin (32-bit) and Ubuntu. In general, resolve all warnings shown when using -Wall -Wextra. pragma
warnings is permitted. -Wstack-usage=65536
to ensure that the stack is not overused. -fstack-protector
. nlib
are ensuring that there are zero cpplint.py
warnings and that compilation and tests succeed in all environments.Platform.h
must appear within code that can be compiled in all environments it could conceivably be used in. That said, inclusion of code that is optimized for specific hardware using SIMD instructions or other such techniques is permitted. NLIB_FINAL
or NLIB_OVERRIDE
and typedef
s to safely incorporate C++11 features and continuously make it possible to port to C++11 or C++14. errno_t
type, as recommended by https://www.securecoding.cert.org/confluence/x/QgAy. nlib
) is written in a way that anticipates the use of these features, such as exception safety. malloc
and free
, use functions like nlib_malloc
and nlib_free
. new (std::nothrow)
for new
. new
operator must not be overloaded within the library. nlib_printf
are passed to Win32 API after conversion to UTF-16 in nlib
. Nflags
) is an exception. char
type must work correctly, whether signed or unsigned. signed char
. wchar_t
is 16-bit; UTF-32 is supported if wchar_t
is 32-bit. NLIB_WCHAR_SIZE
is defined as either 2 or 4, so you can use this to make the determination. nlib_utf16_t
as the type for UTF-16 characters, and use nlib_utf32_t
as the type for UTF-32 characters. typedef
as char16_t
and char32_t
, respectively. nlib_strcplen_ex
allows you to request the number of code points and byte length simultaneously while performing validation. If SIMD is supported, this operation can be sped up even more. NLIB_CXX11_RVALUE_REFERENCES
, and you must also define member functions like the following so that the same functionality can be implemented in C++03. boost::move
exist, but they cannot achieve full compatibility, so they are not used. type_traits
are used with care. This feature of C++11 is sometimes buggy or is not a complete implementation for some compilers or compiler versions. A tentative wrapper has been provided in nn/nlib/TypeTraits.h
, but only use it if there is no other alternative. NLIB_DISALLOW_COPY_AND_ASSIGN
instead. .h
format. There are two reasons for this. %<xxx.h%>
and %<cxxx%>
formats within nlib. (The %<xxx.h%>
format must be included because there is a requirement that nn/nlib/Platform.h
can be compiled with a C compiler.) testing
library can be used. gcc
, you can calculate test coverage automatically by using gcovr
. manual.h
files located within each include directory. English versions of the manual are stored as manual_en.h
. This approach allows multiple languages to be managed within the same repository. CMakeLists.txt
. Using CMake allows you to generate makefiles for GNU make, Visual Studio and Xcode projects by writing this CMakefiles.txt
script file. CPack
). CTest
). nlib
, using CMake allows you to generate solution files that work with all Visual Studio versions, makefiles for UNIX and Cygwin, and so on, and then build the program. ./cmake/toolchain-cafe.cmake
and ./cmake/toolchain-ctr.cmake
files within the package are configured for cross-compilation. This makes it possible to use CMake to generate makefiles even for CAFE/CTR sample programs, and then build the programs. The CAFE and CTR versions of nlib
also have scripts for the standard make
and omake
build systems.nlib
, and their workarounds.nlib
uses new
(std::nothrow
) for memory allocation. When applications and other libraries overload new
or delete
, operator new(size_t, const std::nothrow_t&)
must also be overloaded. heap_replace_malloc
sample.nlib
does not use malloc
or free
directly. Instead, it uses functions like nlib_malloc
and nlib_free
. These functions are weakly defined, so they can be overridden by user-defined functions. heap_replace_malloc
sample.cmake/common.cmake.win32
within the package. Please reference them.MACRO_XXXX
using the command-line arguments to the compiler.nlib
. Writing acceptance tests for future use makes it easier to make this type of decision. However, only the latest version receives support. Note this fact.nlib
are permitted to restructure or repackage nlib
and to redistribute it, but only within the project.nlib_printf
must be encoded using UTF-8.OSS
libraries to 3.1.4.1. nlib_bitreverse32()
and nlib_bitreverse64()
. O_EXCL(NLIB_FD_O_EXCL)
in nlib_fd_open()/tt>.
Modified nlib_fd_create()
so that it fails if the file already exists.
nlib_strcplen2()
was renamed nlib_strcplen()
. nlib_strcplen2()
will be provided as a macro for a while and then be deleted.
nlib_popcnt()
was renamed nlib_popcnt32()
. nlib_popcnt()
will be provided as a macro for a while and then be deleted.
nlib_clz()
was renamed nlib_clz32()
. nlib_clz()
will be provided as a macro for a while and then be deleted.
nlib_ctz()
was renamed nlib_ctz32()
. nlib_ctz()
will be provided as a macro for a while and then be deleted.
Deleted deprecated files and functions.
Made other minor changes and fixes.
heap::CentralHeap::FreeWithSize()
, heap::CentralHeap::GetAllocSize()
, and heap::CentralHeap::Realloc()
. NMALLOC_QUERY_SET_COLOR
, NMALLOC_QUERY_GET_COLOR
, NMALLOC_QUERY_SET_NAME
and NMALLOC_QUERY_GET_NAME
to queries for nmalloc_query()
. This function associates a 24-bit integer value or a string with any allocated region of 4096 bytes or more. object_tracking
sample in the heap
library. NMALLOC_DUMP_PAGESUMMARY
to NMallocDumpMode
. nmalloc
, when failing to allocate a TLS index. nmalloc_setmark1()
, nmalloc_setmark2()
, nmalloc_getmark()
and nmalloc_getobjptr()
are now deprecated. They will be deleted in a future release. NMALLOC_HEAPOPTION_CHECK_0
and NMALLOC_HEAPOPTION_CHECK_1
are now deprecated. They will be deleted in a future release.
nlib_memcplen()
, nlib_memutf8_to_utf16()
, nlib_memutf16_to_utf8()
, nlib_memutf8_to_utf32()
, and nlib_memutf32_to_utf8()
. nlib_strcplen2()
. nlib_strcplen()
and nlib_strcplen_ex()
are now deprecated. They will be deleted in future releases. nlib_basename()
and nlib_dirname()
. nlib_strlcpy()
. nlib_memccpy()
. nlib_memspn()
and nlib_memcspn()
. nlib_strcat()
, nlib_strncat()
, nlib_wcscat()
, and nlib_wcsncat()
are now deprecated. They will be deleted in future releases. nn::nlib::StrCat()
and nn::nlib::StrNcat()
are now deprecated. They will be deleted in future releases.
nlib_sleep()
, that have been declared in the misc
library in the global namespace are now moved from that library to the new libn
library. lib/cmake/gcc
to lib/cmake/cygwin
. nlib_isalnum()
, nlib_isalpha()
, nlib_iscntrl()
, nlib_isdigit()
, nlib_isgraph()
, nlib_islower()
, nlib_isprint()
, nlib_ispunct()
, nlib_isspace()
, nlib_isupper()
, nlib_isxdigit()
, nlib_tolower()
, and nlib_toupper()
. IsAlnum()
, implemented as C++ functions. nlib_strto_int32()
, nlib_strto_int64()
, nlib_strto_uint32()
, nlib_strto_int64()
, nlib_strto_double()
, nlib_strto_float()
, nlib_strto_int32_fallback()
, nlib_strto_int64_fallback()
, nlib_strto_uint32_fallback()
, nlib_strto_int64_fallback()
, nlib_strto_double_fallback()
, nlib_strto_float_fallback()
, nlib_strto_int8()
, nlib_strto_int16()
, nlib_strto_uint8()
, and nlib_strto_uint16()
. StrTo()
and StrToFallback()
implemented as C++ functions. nlib_epochtime_timespec()
, nlib_ticktime_timespec()
, nlib_sleep_timespec()
, nlib_mutex_trylock_for_timespec()
, nlib_semaphore_trywait_for_timespec()
, nlib_cond_wait_for_timespec()
, nlib_cond_wait_until_timespec()
, nlib_rwlock_tryrdlock_for_timespec()
, nlib_rwlock_tryrdlock_until_timespec()
, nlib_rwlock_trywrlock_for_timespec()
, nlib_rwlock_trywrlock_until_timespec()
, nlib_condrwlock_wait_for_timespec()
, and nlib_condrwlock_wait_until_timespec()
. nlib_fd_open()
is changed to change the last argument type from void*
to int
and specify access permission. nlib_thread_setname()
is changed to allow you to specify a thread you want to change its name. heap::CentralHeap(nmalloc)
of the heap
library has been further improved.
lib/cmake/gcc
to lib/cmake/cygwin
. nlib_remove()
and nlib_thread_getname()
. heap::CentralHeap(nmalloc)
of the heap
library.
heap::CentralHeap
(nmalloc)
from the heap
library caused fragmentation. oss
libraries. In addition, temporary files can be now automatically deleted. nlib_fd_pwrite()
and nlib_fd_pread()
for the CAFE and CTR versions, corrected the behavior found when an offset larger than the file size is specified. simd::I64
is now deprecated. Crc32
class is now deprecated. Use nlib_crc32()
or nlib_crc32c()
instead.
nlib_compiler_version()
function was added to the misc
library. It returns the compiler version used to compile nlib. nlib_crc32()
and nlib_crc32c()
functions were added to the misc
library. simd
library. simd
library.
oss
library now uses nlib_malloc
instead of nmalloc
in platforms other than CAFE and CTR. NMALLOC_QUERY_UNIFY_FREELIST
can now be specified for the argument of nmalloc_query()
in the heap
library. heap
library's CentralHeap
is reduced. simd::I128::PopCntMask8()
, simd::I128::ClzMask8()
, and simd::I128::CtzMask8()
to the simd
library. nlib_malloc_size()
could not be used in the Windows version of the DLL.
nlib_is_error()
function. It allows errors to be definitely evaluated and described for the return values of errno_t or bool. nlib_getenv()
function now supports CAFE and CTR. IsOk()
and IsError()
functions for each class have been depreciated. Use the nlib_is_error()
or operator bool()
function instead. Init()
member function to Utf16InputStream
, Utf32InputStream
, WcharInputStream
, Base64InputStream
and Base64OutputStream
in the misc
library. TextReader
, TextWriter
, BinaryReader
and BinaryWriter
classes for the misc
library is now split into two stages: one with Init()
and one with Open()
. IsOk()
, IsError()
, Initialize()
and GetErrorValue()
member functions for each class in the exi
library have been depreciated. Initialize()
member function for each class in the heap
library has been depreciated. CsvReader
class for the msgpack
library is now split into two stages: one with Init()
and one with Open()
. nmalloc_aligned()
crashed if memory was assigned with an alignment larger than 4096 bytes. nmalloc_query(NMALLOC_QUERY_MAX_ALLOCATABLE_SIZE, ...)
could return a size larger than the one actually allocated. F128::StoreLoA4()
and F128::StoreHiA4()
of the simd
library may crash during operation on the ARM processor. © 2012-2016 Nintendo Co., Ltd. All rights reserved.