summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/CompilerKit/AST.h3
-rw-r--r--include/CompilerKit/CodeGenerator.h3
-rw-r--r--include/CompilerKit/Detail/Config.h2
-rw-r--r--include/CompilerKit/Detail/PreConfig.h3
-rw-r--r--include/CompilerKit/MachO.h4
-rw-r--r--include/CompilerKit/UUID.h2
-rw-r--r--include/CompilerKit/Utils/Assembler.h (renamed from include/CompilerKit/Utilities/Assembler.h)2
-rw-r--r--include/CompilerKit/Utils/Compiler.h (renamed from include/CompilerKit/Utilities/Compiler.h)24
-rw-r--r--include/CompilerKit/Utils/DLL.h (renamed from include/CompilerKit/Utilities/DLL.h)3
-rw-r--r--include/CoreRuntimeKit/C++/abi/abi.hpp (renamed from include/CoreRuntimeKit/C++/__abi)5
-rw-r--r--include/CoreRuntimeKit/C++/abi/new.hpp (renamed from include/CoreRuntimeKit/C++/new)2
-rw-r--r--include/CoreRuntimeKit/C++/core/base_alloc.hpp (renamed from include/CoreRuntimeKit/C++/base_alloc)2
-rw-r--r--include/CoreRuntimeKit/C++/core/base_exception.hpp (renamed from include/CoreRuntimeKit/C++/base_exception)2
-rw-r--r--include/CoreRuntimeKit/C++/core/base_math.hpp (renamed from include/CoreRuntimeKit/C++/base_math)0
-rw-r--r--include/CoreRuntimeKit/C++/core/base_process.hpp (renamed from include/CoreRuntimeKit/C++/base_process)8
-rw-r--r--include/CoreRuntimeKit/C++/defines.hpp (renamed from include/CoreRuntimeKit/C++/defines)0
-rw-r--r--include/CoreRuntimeKit/C++/filesystem/filesystem.hpp (renamed from include/CoreRuntimeKit/C++/filesystem)0
-rw-r--r--include/CoreRuntimeKit/C++/utility.hpp (renamed from include/CoreRuntimeKit/C++/utility)0
-rw-r--r--include/CoreRuntimeKit/Nectar/exports.hpp (renamed from include/CoreRuntimeKit/Nectar/ncl_exports.h)8
-rw-r--r--include/CoreRuntimeKit/README.md8
-rw-r--r--include/GenericsLibrary/algorithm.nhh17
-rw-r--r--include/GenericsLibrary/fstream.nhh20
-rw-r--r--include/GenericsLibrary/io.nhh4
-rw-r--r--include/GenericsLibrary/iterator.nhh32
-rw-r--r--include/GenericsLibrary/nrt.nc2
-rw-r--r--include/GenericsLibrary/std.nhh7
-rw-r--r--include/GenericsLibrary/thread.nhh22
-rw-r--r--include/ThirdParty/Dialogs/Dialogs.h43
28 files changed, 122 insertions, 106 deletions
diff --git a/include/CompilerKit/AST.h b/include/CompilerKit/AST.h
index 20389c3..c1313ce 100644
--- a/include/CompilerKit/AST.h
+++ b/include/CompilerKit/AST.h
@@ -1,4 +1,5 @@
-// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (See accompanying
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/ne-foss-org/nectar
diff --git a/include/CompilerKit/CodeGenerator.h b/include/CompilerKit/CodeGenerator.h
index f2cbe9d..ac42879 100644
--- a/include/CompilerKit/CodeGenerator.h
+++ b/include/CompilerKit/CodeGenerator.h
@@ -1,4 +1,5 @@
-// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (See accompanying
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/ne-foss-org/nectar
diff --git a/include/CompilerKit/Detail/Config.h b/include/CompilerKit/Detail/Config.h
index 651904e..3693754 100644
--- a/include/CompilerKit/Detail/Config.h
+++ b/include/CompilerKit/Detail/Config.h
@@ -16,6 +16,7 @@
#include <ocl/tproc.hpp>
namespace CompilerKit {
+
inline static constexpr int kBaseYear = 1900;
using STLString = std::string;
using RopeString = ocl::tproc::crope;
@@ -63,6 +64,7 @@ inline bool install_signal(Int32 signal, void (*handler)(int)) noexcept {
return true;
}
+
} // namespace CompilerKit
#endif // __COMPILERKIT_CONFIG_H__
diff --git a/include/CompilerKit/Detail/PreConfig.h b/include/CompilerKit/Detail/PreConfig.h
index 882e00b..9294c01 100644
--- a/include/CompilerKit/Detail/PreConfig.h
+++ b/include/CompilerKit/Detail/PreConfig.h
@@ -87,8 +87,7 @@
#define kObjectFileExt ".obj"
#define kBinaryFileExt ".bin"
-#define kAsmFileExts \
- { ".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64" }
+#define kAsmFileExts {".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64"}
#define kAsmFileExtsMax (7U)
diff --git a/include/CompilerKit/MachO.h b/include/CompilerKit/MachO.h
index 05131ad..2942420 100644
--- a/include/CompilerKit/MachO.h
+++ b/include/CompilerKit/MachO.h
@@ -43,7 +43,9 @@ namespace MachO {
constexpr uint32_t kSectionAlign = 4;
/// @brief Helper to align a value to page boundary
- inline uint64_t AlignToPage(uint64_t value) { return (value + kPageSize - 1) & ~(kPageSize - 1); }
+ inline uint64_t AlignToPage(uint64_t value) {
+ return (value + kPageSize - 1) & ~(kPageSize - 1);
+ }
/// @brief Helper to copy segment/section name safely
inline void CopySegmentName(char* dest, const char* src) {
diff --git a/include/CompilerKit/UUID.h b/include/CompilerKit/UUID.h
index a334052..02f95dc 100644
--- a/include/CompilerKit/UUID.h
+++ b/include/CompilerKit/UUID.h
@@ -165,7 +165,7 @@ namespace Detail {
process_byte(static_cast<unsigned char>((bitCount >> 24) & 0xFF));
process_byte(static_cast<unsigned char>((bitCount >> 16) & 0xFF));
process_byte(static_cast<unsigned char>((bitCount >> 8) & 0xFF));
- process_byte(static_cast<unsigned char>((bitCount) &0xFF));
+ process_byte(static_cast<unsigned char>((bitCount) & 0xFF));
memcpy(digest, m_digest, 5 * sizeof(uint32_t));
return digest;
diff --git a/include/CompilerKit/Utilities/Assembler.h b/include/CompilerKit/Utils/Assembler.h
index 8e5821a..6beff60 100644
--- a/include/CompilerKit/Utilities/Assembler.h
+++ b/include/CompilerKit/Utils/Assembler.h
@@ -8,7 +8,7 @@
#include <CompilerKit/AST.h>
#include <CompilerKit/CodeGenerator.h>
-#include <CompilerKit/Utilities/Compiler.h>
+#include <CompilerKit/Utils/Compiler.h>
namespace CompilerKit {
/// @brief Get Number from lineBuffer.
diff --git a/include/CompilerKit/Utilities/Compiler.h b/include/CompilerKit/Utils/Compiler.h
index 0c787ba..094647b 100644
--- a/include/CompilerKit/Utilities/Compiler.h
+++ b/include/CompilerKit/Utils/Compiler.h
@@ -21,14 +21,14 @@
#define kCode128Section ".code128"
#define kData128Section ".data128"
-#define kBlank "\e[0;30m"
+#define kBlank "\e[0;0m"
#define kRed "\e[0;31m"
#define kWhite "\e[0;97m"
#define kYellow "\e[0;33m"
-#define kBlackOverWhite "\E[0;37m"
+#define kReset kBlank
-#define kStdOut (std::cout << kRed << "Nectar: " << kBlackOverWhite)
-#define kStdErr (std::cerr << kRed << "Nectar: " << kBlackOverWhite)
+#define kStdOut (std::cout << kRed << "nectar: " << kReset)
+#define kStdErr (std::cerr << kRed << "nectar: " << kReset)
#define kStdEndl std::endl
#define kPrintF kStdOut
#define kPrintErr kStdErr
@@ -75,24 +75,22 @@ inline void drvi_crash_handler(std::int32_t id) {
std::cout << '=';
}
- std::cout << std::endl;
-
- std::cout << verbose_header << std::endl;
+ kStdOut << kStdEndl;
+ kStdOut << verbose_header << kStdEndl;
for (auto& ch : verbose_header) {
std::cout << '=';
}
- std::cout << std::endl;
+ kStdOut << kStdEndl;
- kStdOut << "DATE: " << CompilerKit::current_date() << std::endl;
- kStdOut << "VERSION: " << kDistVersion << std::endl;
- kStdOut << "ERRNO: " << errno << std::endl;
- kStdOut << "ERRNO(STRING): " << strerror(errno) << std::endl;
+ kStdOut << "DATE: " << CompilerKit::current_date() << kStdEndl;
+ kStdOut << "VERSION: " << kDistVersion << kStdEndl;
+ kStdOut << "ERRNO: " << errno << kStdEndl;
switch (id) {
default: {
- kStdOut << "SIGNAL: (" << id << ")." << kBlank << std::endl;
+ kStdOut << "SIGNAL: (" << id << ")." << kBlank << kStdEndl;
break;
}
}
diff --git a/include/CompilerKit/Utilities/DLL.h b/include/CompilerKit/Utils/DLL.h
index 461661a..6d12538 100644
--- a/include/CompilerKit/Utilities/DLL.h
+++ b/include/CompilerKit/Utils/DLL.h
@@ -1,4 +1,5 @@
-// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (See accompanying
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/ne-foss-org/nectar
diff --git a/include/CoreRuntimeKit/C++/__abi b/include/CoreRuntimeKit/C++/abi/abi.hpp
index 0252e0b..c0a2680 100644
--- a/include/CoreRuntimeKit/C++/__abi
+++ b/include/CoreRuntimeKit/C++/abi/abi.hpp
@@ -10,12 +10,11 @@
__init_decl()
- static constexpr int32_t __unreachable_code = 34;
+static constexpr int32_t __unreachable_code = 34;
inline void __compilerkit_unreachable(void) {
std::base_process::signal(__unreachable_code);
-
- while (1);
+ while (true);
}
__fini_decl()
diff --git a/include/CoreRuntimeKit/C++/new b/include/CoreRuntimeKit/C++/abi/new.hpp
index 71afa28..9e86e22 100644
--- a/include/CoreRuntimeKit/C++/new
+++ b/include/CoreRuntimeKit/C++/abi/new.hpp
@@ -8,6 +8,7 @@
#include <defines>
namespace std {
+
struct nothrow_t final {
explicit nothrow_t() = default;
~nothrow_t() = default;
@@ -21,6 +22,7 @@ struct placement_t final {
int32_t __align{};
size_t __size{};
};
+
} // namespace std
// AMLALE: Define the placement_t feature.
diff --git a/include/CoreRuntimeKit/C++/base_alloc b/include/CoreRuntimeKit/C++/core/base_alloc.hpp
index 9e10f92..4d715f7 100644
--- a/include/CoreRuntimeKit/C++/base_alloc
+++ b/include/CoreRuntimeKit/C++/core/base_alloc.hpp
@@ -8,6 +8,7 @@
#include <defines>
namespace std::base_alloc {
+
/// @brief allocate a new class.
/// @tparam KindClass the class type to allocate.
template <class KindClass, typename... Args>
@@ -39,4 +40,5 @@ template <class KindClass>
inline void release_nothrow(KindClass ptr) noexcept {
release(ptr);
}
+
} // namespace std::base_alloc
diff --git a/include/CoreRuntimeKit/C++/base_exception b/include/CoreRuntimeKit/C++/core/base_exception.hpp
index db1de01..c103da5 100644
--- a/include/CoreRuntimeKit/C++/base_exception
+++ b/include/CoreRuntimeKit/C++/core/base_exception.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include <__abi>
+#include <abi>
#include <base_process>
#include <defines>
#include <iostream>
diff --git a/include/CoreRuntimeKit/C++/base_math b/include/CoreRuntimeKit/C++/core/base_math.hpp
index 6691c27..6691c27 100644
--- a/include/CoreRuntimeKit/C++/base_math
+++ b/include/CoreRuntimeKit/C++/core/base_math.hpp
diff --git a/include/CoreRuntimeKit/C++/base_process b/include/CoreRuntimeKit/C++/core/base_process.hpp
index 45de8fd..84354a9 100644
--- a/include/CoreRuntimeKit/C++/base_process
+++ b/include/CoreRuntimeKit/C++/core/base_process.hpp
@@ -9,10 +9,10 @@
__init_decl()
- /// @brief CRT exit, with exit code (!!! exits all threads. !!!)
- /// @param code the exit code.
- /// @return the return > 0 for non successful.
- extern int exit_(int code);
+/// @brief CRT exit, with exit code (!!! exits all threads. !!!)
+/// @param code the exit code.
+/// @return the return > 0 for non successful.
+extern int exit_(int code);
/// @brief CRT signal handler.
/// @param code the signal code.
diff --git a/include/CoreRuntimeKit/C++/defines b/include/CoreRuntimeKit/C++/defines.hpp
index 3cd1ee1..3cd1ee1 100644
--- a/include/CoreRuntimeKit/C++/defines
+++ b/include/CoreRuntimeKit/C++/defines.hpp
diff --git a/include/CoreRuntimeKit/C++/filesystem b/include/CoreRuntimeKit/C++/filesystem/filesystem.hpp
index 917dd0f..917dd0f 100644
--- a/include/CoreRuntimeKit/C++/filesystem
+++ b/include/CoreRuntimeKit/C++/filesystem/filesystem.hpp
diff --git a/include/CoreRuntimeKit/C++/utility b/include/CoreRuntimeKit/C++/utility.hpp
index a427c44..a427c44 100644
--- a/include/CoreRuntimeKit/C++/utility
+++ b/include/CoreRuntimeKit/C++/utility.hpp
diff --git a/include/CoreRuntimeKit/Nectar/ncl_exports.h b/include/CoreRuntimeKit/Nectar/exports.hpp
index 115484f..72638af 100644
--- a/include/CoreRuntimeKit/Nectar/ncl_exports.h
+++ b/include/CoreRuntimeKit/Nectar/exports.hpp
@@ -5,3 +5,11 @@
// Official repository: https://github.com/ne-foss-org/nectar
#pragma once
+
+#include <CoreRuntimeKit/C++/abi/abi.hpp>
+#include <CoreRuntimeKit/C++/abi/new.hpp>
+
+/// @brief The Nectar FFI.
+namespace nectar_lang {
+
+}
diff --git a/include/CoreRuntimeKit/README.md b/include/CoreRuntimeKit/README.md
index 356eaf5..84d50bb 100644
--- a/include/CoreRuntimeKit/README.md
+++ b/include/CoreRuntimeKit/README.md
@@ -1,8 +1,12 @@
-# The NectarCoreLibrary
+# The Nectar Core Support Libraries:
## Abstract:
-The NCL is a kit used to interact with other programs using the FFI of Nectar.
+The NCSL is a framework used to interact with other programs using the concept of FFI in Nectar.
The implmentation is still in progress, feel free to open a PR to propose a new function.
+## Example:
+
+**No examples are available right now, we're working on some.**
+
diff --git a/include/GenericsLibrary/algorithm.nhh b/include/GenericsLibrary/algorithm.nhh
index 5d1bc32..1dd1e0c 100644
--- a/include/GenericsLibrary/algorithm.nhh
+++ b/include/GenericsLibrary/algorithm.nhh
@@ -9,9 +9,9 @@
//@ Free algorithm functions for GenericsLibrary.
-let for_each(let iterator_instance, let action)
+let for_each(let it, let action)
{
- for (let i := iterator_instance.begin(); i != iterator_instance.end(); i += 1)
+ for (let i := it.begin(); i != it.end(); i += 1)
{
action(i);
}
@@ -19,9 +19,9 @@ let for_each(let iterator_instance, let action)
return;
}
-let find(let iterator_instance, let predicate)
+let find(let it, let predicate)
{
- for (let i := iterator_instance.begin(); i != iterator_instance.end(); i += 1)
+ for (let i := it.begin(); i != it.end(); i += 1)
{
if (predicate(i))
{
@@ -29,15 +29,18 @@ let find(let iterator_instance, let predicate)
}
}
- return -1;
+ return 1;
}
let remove(let it, let pred)
{
- for (let i = it.begin(); i != i != it.end(); ++i)
+ for (let i = it.begin(); i != it.end(); ++i)
{
if (pred(i))
- return 0;
+ {
+ i = 0;
+ return 0;
+ }
}
return 1;
diff --git a/include/GenericsLibrary/fstream.nhh b/include/GenericsLibrary/fstream.nhh
index 4808dd8..441b686 100644
--- a/include/GenericsLibrary/fstream.nhh
+++ b/include/GenericsLibrary/fstream.nhh
@@ -22,27 +22,15 @@ trait fstream_traits
//@ Implementation of fstream traits.
impl fstream : trait fstream_traits
{
- let init()
+ let write(let self, let data, let size)
{
- return;
- }
-
- let dispose()
- {
- return;
- }
-
- let write(let data, let size)
- {
- let written := __traits_write(fd_, data, size);
-
+ let written := __traits_write(self.fd_, data, size);
return written;
}
- let read(let region, let size)
+ let read(let self, let data, let size)
{
- let readen := __traits_read(fd_, region, size);
-
+ let readen := __traits_read(self.fd_, data, size);
return readen;
}
};
diff --git a/include/GenericsLibrary/io.nhh b/include/GenericsLibrary/io.nhh
index 25bc561..bf2f351 100644
--- a/include/GenericsLibrary/io.nhh
+++ b/include/GenericsLibrary/io.nhh
@@ -7,14 +7,14 @@
#ifndef NECTAR_GL_IO_NHH
#define NECTAR_GL_IO_NHH
-import ncl_printf;
+import core_print_format_ln;
const writefn(let fmt, let args)
{
if (fmt := 0)
return;
- ncl_printf(fmt, {args});
+ core_print_format_ln(fmt, {args});
}
#endif
diff --git a/include/GenericsLibrary/iterator.nhh b/include/GenericsLibrary/iterator.nhh
index e509bc2..ecc82ed 100644
--- a/include/GenericsLibrary/iterator.nhh
+++ b/include/GenericsLibrary/iterator.nhh
@@ -24,38 +24,26 @@ trait iterator_traits
impl iterator : trait iterator_traits
{
- let init()
+ let begin(let self)
{
- return 0;
- }
-
- let dispose()
- {
- return 0;
- }
-
- let begin()
- {
- must_pass(_begin != _end);
+ must_pass(self._begin != self._end);
- let end := _begin;
- return end;
+ let begin := self._begin;
+ return begin;
}
- let end()
+ let end(let self)
{
- must_pass(_begin != _end);
+ must_pass(_begin != _end);
- let end :=_begin;
- end += _end;
-
+ let end := self._end;
return end;
}
- let size()
+ let size(let self)
{
- must_pass(_size > 0);
- return _size;
+ must_pass(self._size > 0);
+ return self._size;
}
};
diff --git a/include/GenericsLibrary/nrt.nc b/include/GenericsLibrary/nrt.nc
index 6a39808..0a62d81 100644
--- a/include/GenericsLibrary/nrt.nc
+++ b/include/GenericsLibrary/nrt.nc
@@ -4,7 +4,7 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/ne-foss-org/nectar
-extern main;
+import main;
//@ The main entrypoint is an external symbol defined by the user program.
//@ You may also define it as a library and then write your own main wrapper over it.
diff --git a/include/GenericsLibrary/std.nhh b/include/GenericsLibrary/std.nhh
index 0727269..677586e 100644
--- a/include/GenericsLibrary/std.nhh
+++ b/include/GenericsLibrary/std.nhh
@@ -6,19 +6,17 @@
#pragma once
-#define PALLOC_INVALID 0
-
extern __nrt_alloc;
extern __nrt_free;
-//@ Parallel free
+//@ Standard free
let free_bytes(let ptr)
{
if (ptr := 0) return 0;
return __nrt_free(ptr);
}
-//@ Parallel alloc (bytes)
+//@ Standard alloc (bytes)
let alloc_bytes(let type, let sz, let align := 0)
{
if (0 := align) return 0;
@@ -27,4 +25,3 @@ let alloc_bytes(let type, let sz, let align := 0)
return __nrt_alloc(type, sz, align);
}
-
diff --git a/include/GenericsLibrary/thread.nhh b/include/GenericsLibrary/thread.nhh
new file mode 100644
index 0000000..f60d110
--- /dev/null
+++ b/include/GenericsLibrary/thread.nhh
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (See accompanying
+// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
+// Official repository: https://github.com/ne-foss-org/nectar
+
+#ifndef NECTAR_GL_THREAD_NHH
+#define NECTAR_GL_THREAD_NHH
+
+trait thread_traits
+{
+ let join();
+ let detach();
+ let get();
+}
+
+let create_thread(let entrypoint, let id);
+let exit_thread(let id);
+
+let get_status_thread(let id);
+
+#endif \ No newline at end of file
diff --git a/include/ThirdParty/Dialogs/Dialogs.h b/include/ThirdParty/Dialogs/Dialogs.h
index f370719..8168dd2 100644
--- a/include/ThirdParty/Dialogs/Dialogs.h
+++ b/include/ThirdParty/Dialogs/Dialogs.h
@@ -176,7 +176,7 @@ namespace internal {
#elif __EMSCRIPTEN__
void start(int exit_code);
#else
- void start_process(std::vector<std::string> const& command);
+ void start_process(std::vector<std::string> const& command);
#endif
~executor();
@@ -219,7 +219,7 @@ namespace internal {
: m_proc(reinterpret_cast<T*>((void*) ::GetProcAddress(lib.handle, sym.c_str()))) {}
explicit operator bool() const { return m_proc != nullptr; }
- operator T*() const { return m_proc; }
+ operator T*() const { return m_proc; }
private:
T* m_proc;
@@ -491,10 +491,10 @@ inline settings::settings(bool resync) {
#if _WIN32
flags(flag::is_vista) = internal::is_vista();
#elif !__APPLE__
- flags(flag::has_zenity) = check_program("zenity");
+ flags(flag::has_zenity) = check_program("zenity");
flags(flag::has_matedialog) = check_program("matedialog");
- flags(flag::has_qarma) = check_program("qarma");
- flags(flag::has_kdialog) = check_program("kdialog");
+ flags(flag::has_qarma) = check_program("qarma");
+ flags(flag::has_kdialog) = check_program("kdialog");
// If multiple helpers are available, try to default to the best one
if (flags(flag::has_zenity) && flags(flag::has_kdialog)) {
@@ -541,7 +541,7 @@ inline bool settings::check_program(std::string const& program) {
(void) program;
return false;
#else
- int exit_code = -1;
+ int exit_code = -1;
internal::executor async;
async.start_process({"/bin/sh", "-c", "which " + program});
async.result(&exit_code);
@@ -605,7 +605,7 @@ inline std::string path::home() {
if (size_max != -1) len = size_t(size_max);
#endif
std::vector<char> buf(len);
- struct passwd pwd, *result;
+ struct passwd pwd, *result;
if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir;
#endif
return "/";
@@ -718,7 +718,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co
}
close(in[1]);
- m_fd = out[0];
+ m_fd = out[0];
auto flags = fcntl(m_fd, F_GETFL);
fcntl(m_fd, F_SETFL, flags | O_NONBLOCK);
@@ -754,7 +754,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
// FIXME: do something
(void) timeout;
#else
- char buf[BUFSIZ];
+ char buf[BUFSIZ];
ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore
if (received > 0) {
m_stdout += std::string(buf, received);
@@ -765,7 +765,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
// (this happens when the calling application handles or ignores SIG_CHLD) and results in
// waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for
// a little while.
- int status;
+ int status;
pid_t child = waitpid(m_pid, &status, WNOHANG);
if (child != m_pid && (child >= 0 || errno != ECHILD)) {
// FIXME: this happens almost always at first iteration
@@ -783,8 +783,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
inline void internal::executor::stop() {
// Loop until the user closes the dialog
- while (!ready())
- ;
+ while (!ready());
}
// dll implementation
@@ -880,11 +879,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const {
#if __APPLE__
return {"osascript"};
#else
- return {flags(flag::has_zenity) ? "zenity"
+ return {flags(flag::has_zenity) ? "zenity"
: flags(flag::has_matedialog) ? "matedialog"
- : flags(flag::has_qarma) ? "qarma"
- : flags(flag::has_kdialog) ? "kdialog"
- : "echo"};
+ : flags(flag::has_qarma) ? "qarma"
+ : flags(flag::has_kdialog) ? "kdialog"
+ : "echo"};
#endif
}
@@ -1126,9 +1125,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title
// Split the pattern list to check whether "*" is in there; if it
// is, we have to disable filters because there is no mechanism in
// OS X for the user to override the filter.
- std::regex sep("\\s+");
- std::string filter_list;
- bool has_filter = true;
+ std::regex sep("\\s+");
+ std::string filter_list;
+ bool has_filter = true;
std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1);
std::sregex_token_iterator end;
for (; iter != end; ++iter) {
@@ -1237,7 +1236,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() {
return m_vector_result;
#else
std::vector<std::string> ret;
- auto result = m_async->result();
+ auto result = m_async->result();
for (;;) {
// Split result along newline characters
auto i = result.find('\n');
@@ -1570,7 +1569,7 @@ inline message::message(std::string const& title, std::string const& text,
if_cancel = button::ok;
break;
}
- m_mappings[1] = if_cancel;
+ m_mappings[1] = if_cancel;
m_mappings[256] = if_cancel; // XXX: I think this was never correct
script += " with icon ";
switch (_icon) {
@@ -1657,7 +1656,7 @@ inline message::message(std::string const& title, std::string const& text,
if (_choice == choice::yes_no_cancel) flag += "cancel";
command.push_back(flag);
if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) {
- m_mappings[0] = button::yes;
+ m_mappings[0] = button::yes;
m_mappings[256] = button::no;
}
}