Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
macroLocation.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19#include <cstring>
20#include <string>
21
22inline std::string __file_to_loc(const char *filename) {
23 return std::string(
24 std::strstr(filename, "/src/") ? std::strstr(filename, "/src/") + 1 : filename);
25}
26
27inline std::string __loc_prefix(const char *filename, int line) {
28 return __file_to_loc(filename) + ":" + std::to_string(line);
29}
30
31#define __FILENAME__ __file_to_loc(__FILE__)
32#define __LOC_PREFIX__ __loc_prefix(__FILE__, __LINE__)
33
34#define __LOC_POSTFIX__ ("(" + __LOC_PREFIX__ + ")")