Skip to content
Snippets Groups Projects
Unverified Commit a25cb100 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

update macro prefix

parent 42bc4e5c
No related branches found
No related tags found
No related merge requests found
MIT License MIT License
Copyright (c) 2017 Recolic Keghart Copyright (c) 2017-2018 Recolic Keghart <root@recolic.net>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
#ifndef R_MACRO_HPP #ifndef R_MACRO_HPP
#define R_MACRO_HPP #define R_MACRO_HPP
#ifndef MACRO_DECAY #ifdef RLIB_EMPTY_MACRO
#define MACRO_DECAY(m) (m) #undef RLIB_EMPTY_MACRO
#endif #endif
#define RLIB_EMPTY_MACRO
#ifndef _R_MACRO_ENSTRING #ifndef RLIB_MACRO_DECAY
#define _R_MACRO_ENSTRING(_s) #_s #define RLIB_MACRO_DECAY(m) (m)
#endif #endif
#ifndef MACRO_TO_CSTR #ifndef _RLIB_MACRO_ENSTRING
#define MACRO_TO_CSTR(m) _R_MACRO_ENSTRING(m) #define _RLIB_MACRO_ENSTRING(_s) #_s
#endif #endif
#ifndef MACRO_EQL #ifndef RLIB_MACRO_TO_CSTR
#define MACRO_EQL(a, b) (MACRO_TO_CSTR(a) == MACRO_TO_CSTR(b)) #define RLIB_MACRO_TO_CSTR(m) _RLIB_MACRO_ENSTRING(m)
#endif #endif
#ifndef MACRO_CAT //#ifndef RLIB_MACRO_EQL
#define MACRO_CAT(a, b) _MACRO_CAT_I(a, b) //#define RLIB_MACRO_EQL(a, b) (RLIB_MACRO_TO_CSTR(a) == RLIB_MACRO_TO_CSTR(b))
#define _MACRO_CAT_I(a, b) _MACRO_CAT_II(~, a ## b) //#endif
#define _MACRO_CAT_II(p, res) res
#ifndef RLIB_MACRO_CAT
#define RLIB_MACRO_CAT(a, b) _RLIB_MACRO_CAT_I(a, b)
#define _RLIB_MACRO_CAT_I(a, b) _RLIB_MACRO_CAT_II(~, a ## b)
#define _RLIB_MACRO_CAT_II(p, res) res
#endif #endif
#ifndef MAKE_UNIQUE_NAME #ifndef RLIB_MAKE_UNIQUE_NAME
#define MAKE_UNIQUE_NAME(base) MACRO_CAT(base, __COUNTER__) #define RLIB_MAKE_UNIQUE_NAME(base) RLIB_MACRO_CAT(base, __COUNTER__)
#endif #endif
#endif #endif
...@@ -47,7 +47,7 @@ namespace rlib { ...@@ -47,7 +47,7 @@ namespace rlib {
#ifndef defer #ifndef defer
#include <rlib/macro.hpp> #include <rlib/macro.hpp>
#define defer(callable) ::rlib::scope_guard MAKE_UNIQUE_NAME(_guarder_id_) (callable) #define defer(callable) ::rlib::scope_guard RLIB_MAKE_UNIQUE_NAME(_guarder_id_) (callable)
#endif #endif
#define reinforce_scope_begin(guarderName, callable) scope_guard guarderName = callable; try{ #define reinforce_scope_begin(guarderName, callable) scope_guard guarderName = callable; try{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment