Jackalope / jlib (public) (License: GPLv3 or later) (since 2019-11-18) (hash sha1)
jlib C++ template library
Used to replace std functionality without exception handling.
- data structures
- filesystem routines
- crossplatform threads interface (currently only pthreads implementation)
- thread pool
- crossplatform dynamic memory functions interface (allocate, reallocate, deallocate) with alignment support
- high percision timer routines based on timespec
List of commits:
Subject Hash Author Date (UTC)
FS limits function fix. 813a0a8aaae122b7b4a4d158cf029aff1733308c Jackalope 2020-05-31 11:05:07
New option JLIB_ALLOCATE_DEBUG fa66e03cd2ea7102bab8a6de3415898c114a27e4 Jackalope 2020-05-31 10:44:49
Changed version config to match versioning compatibility. 393953edfa42b24e43ba027c5d52d7c2df6cf861 Jackalope 2020-05-31 10:43:09
Thread pool wrong doxygen tag fix. 8392eb800adc01d587d9f6ce962ad403f1e5c80c Jackalope 2020-05-29 16:51:33
jassert macro compatibility in if statement without braces. 5c749b8c1cb2cb51c8ddf6ccedef8d72554d6c68 Jackalope 2020-05-29 15:54:53
Version 0.3.0 616c945f21a8da901facc7363c3b204216776a1d Jackalope 2020-05-26 14:37:18
Removing deprecated threads and old thread pool. b2ce1a8eb5b4a1b9c5d6a19fe75e7a52738e6866 Jackalope 2020-05-26 14:31:57
Resolved issues and warnings with GCC. c9ee73408a660c723dd51b74311d572ec4ef2320 Jackalope 2020-05-26 14:19:43
Thread result can be only pointer now. 645f6ce75c773fd2fad543bfd542202d02925288 Jackalope 2020-05-26 14:19:11
Option JLIB_STATIC to select static or shared library. 08b3a60286a7487ce445f66852f0afdd0f99be69 Jackalope 2020-05-26 14:17:11
Add warning compilation flags. 071b3c83090367f7c2beea5394b926c14620dc66 Jackalope 2020-05-26 13:25:37
New thread pool implementation. 849910e5b45ab543231e24650368289a180452d6 Jackalope 2020-05-26 08:59:03
rarray::iterator_index function 7ee95c6b048973f209fc4e365af36a3dcdb06c4b Jackalope 2020-05-26 08:58:20
darray::remove_last_if_exist logic fix 1664bbfba9d4d8098542c8138a548e4377304aa6 Jackalope 2020-05-26 08:55:31
remove float convertion warning 1ea4783034b873f7711e2ecf840955818c07bcd0 Jackalope 2020-05-26 08:54:04
threads refactoring 9b03fd0beb928de9f3f3e492bb1d324356152de3 Jackalope 2020-05-26 08:52:26
changed notice about native compilation 7b48919f0f46df08f14c8a867d7d1c5d14c19efb Jackalope 2020-05-24 16:37:16
remove LTO option a95b60656c6c00d64efd769d5047853315964556 Jackalope 2020-05-24 13:39:59
compiler options and optimizations 92bc2d91c14c58ce630a7f4f400b5d076ac03286 Jackalope 2020-05-24 01:16:59
cpu_number return unsigned int b9c11a1b4474747c313957bef5573d1db6c481ff Jackalope 2020-05-24 00:13:29
Commit 813a0a8aaae122b7b4a4d158cf029aff1733308c - FS limits function fix.
Author: Jackalope
Author date (UTC): 2020-05-31 11:05
Committer name: Jackalope
Committer date (UTC): 2020-05-31 11:15
Parent(s): fa66e03cd2ea7102bab8a6de3415898c114a27e4
Signing key:
Tree: 4243ea28cfaaa3a4914cdc9be72f8ea60cdf656f
File Lines added Lines deleted
include/jlib/fs/directory.h 17 0
include/jlib/fs/staff.h 25 23
File include/jlib/fs/directory.h changed (mode: 100644) (index bc018c3..befb317)
22 22 #pragma once #pragma once
23 23 #include "staff.h" #include "staff.h"
24 24 #include <libgen.h> #include <libgen.h>
25 #ifdef _WIN32
26 #include <jlib/allocate.h>
27 #endif
25 28 /** /**
26 29 * @brief Namespace with functions for system directories manipulation. * @brief Namespace with functions for system directories manipulation.
27 30 */ */
 
... ... namespace jl::fs::dir
73 76 [[nodiscard]] inline bool current(char *p_dst, uint64_t limit) { [[nodiscard]] inline bool current(char *p_dst, uint64_t limit) {
74 77 return getcwd(p_dst, limit) != nullptr; return getcwd(p_dst, limit) != nullptr;
75 78 } }
79 [[nodiscard]] inline bool current(char **pp_dst) {
80 #ifdef _WIN32
81 if (not jl::allocate_bytes(pp_dst, MAX_PATH))
82 return false;
83 if (not current(*pp_dst, MAX_PATH)) {
84 jl::deallocate(pp_dst);
85 return false;
86 }
87 return true;
88 #else
89 *pp_dst = get_current_dir_name();
90 return *pp_dst != nullptr;
91 #endif
92 }
76 93 /** /**
77 94 * @brief Modify file path to be directory path where this file is. * @brief Modify file path to be directory path where this file is.
78 95 * *
File include/jlib/fs/staff.h changed (mode: 100644) (index fcb24af..348b4f5)
21 21 */ */
22 22 #pragma once #pragma once
23 23 #include <sys/stat.h> #include <sys/stat.h>
24 #ifndef _WIN32
24 #ifdef _WIN32
25 #include <minwindef.h>
26 #else
25 27 #include <linux/limits.h> #include <linux/limits.h>
26 28 #endif #endif
27 29 #include <cinttypes> #include <cinttypes>
 
32 34 #ifndef _WIN32 #ifndef _WIN32
33 35 namespace jl::fs::details { namespace jl::fs::details {
34 36 [[nodiscard]] inline bool [[nodiscard]] inline bool
35 fs_info(const char *fname, int type, uint64_t *p_dst) {
36 auto length = pathconf(fname, type);
37 if (length < 0)
38 return false;
39 *p_dst = uint64_t(length);
40 return true;
37 fs_info(const char *fname, int type, int64_t *p_dst) {
38 errno = 0;
39 *p_dst = pathconf(fname, type);
40 return *p_dst < 0 ? errno == 0 : true;
41 41 } }
42 42 } }
43 43 #endif #endif
 
... ... namespace jl::fs
66 66 permissions(mode user, mode group = mode::READ, mode other = mode::READ) { permissions(mode user, mode group = mode::READ, mode other = mode::READ) {
67 67 return perm(perm(user) << 6 | perm(group) << 3 | perm(other)); return perm(perm(user) << 6 | perm(group) << 3 | perm(other));
68 68 } }
69 #ifndef _WIN32
70 /// @brief Get max file path length
69 /// @brief Get max file path length.
70 /// @param p_dst Limit or -1 (unlimited) will be set.
71 /// @return If failed - check errno for details.
71 72 [[nodiscard]] inline bool [[nodiscard]] inline bool
72 max_path_length(const char *fname, uint64_t *p_dst) {
73 max_path_length(const char *fname, int64_t *p_dst) {
74 #ifdef _WIN32
75 (void)fname;
76 return *p_dst = MAX_PATH, true;
77 #else
73 78 return details::fs_info(fname, _PC_PATH_MAX, p_dst); return details::fs_info(fname, _PC_PATH_MAX, p_dst);
79 #endif
74 80 } }
75 /// @brief Get max file name length
81 /// @brief Get max file name length.
82 /// @param p_dst Limit or -1 (unlimited) will be set.
83 /// @return If failed - check errno for details.
76 84 [[nodiscard]] inline bool [[nodiscard]] inline bool
77 max_name_length(const char *fname, uint64_t *p_dst) {
78 return details::fs_info(fname, _PC_NAME_MAX, p_dst);
79 }
85 max_name_length(const char *fname, int64_t *p_dst) {
86 #ifdef _WIN32
87 (void)fname;
88 return *p_dst = MAX_PATH, true;
80 89 #else #else
81 /// @brief Get max file path length
82 [[nodiscard]] inline bool max_path_length(const char *, uint64_t *p_dst) {
83 return *p_dst = PATH_MAX, true;
84 }
85 /// @brief Get max file name length
86 [[nodiscard]] inline bool max_name_length(const char *, uint64_t *p_dst) {
87 return *p_dst = PATH_MAX, true;
88 }
90 return details::fs_info(fname, _PC_NAME_MAX, p_dst);
89 91 #endif #endif
92 }
90 93 /// @brief Get file or directory modification time. /// @brief Get file or directory modification time.
91 94 [[nodiscard]] inline bool [[nodiscard]] inline bool
92 95 modification_time(const char *path, time_t *p_dst) { modification_time(const char *path, time_t *p_dst) {
 
... ... namespace jl::fs
117 120 return strerror(errno); return strerror(errno);
118 121 } }
119 122 } }
120
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Jackalope/jlib

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/jlib

Clone this repository using git:
git clone git://git.rocketgit.com/user/Jackalope/jlib

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main