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
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
of this software and associated documentation files (the "Software"), to deal
......
#ifndef R_MACRO_HPP
#define R_MACRO_HPP
#ifndef MACRO_DECAY
#define MACRO_DECAY(m) (m)
#ifdef RLIB_EMPTY_MACRO
#undef RLIB_EMPTY_MACRO
#endif
#define RLIB_EMPTY_MACRO
#ifndef _R_MACRO_ENSTRING
#define _R_MACRO_ENSTRING(_s) #_s
#ifndef RLIB_MACRO_DECAY
#define RLIB_MACRO_DECAY(m) (m)
#endif
#ifndef MACRO_TO_CSTR
#define MACRO_TO_CSTR(m) _R_MACRO_ENSTRING(m)
#ifndef _RLIB_MACRO_ENSTRING
#define _RLIB_MACRO_ENSTRING(_s) #_s
#endif
#ifndef MACRO_EQL
#define MACRO_EQL(a, b) (MACRO_TO_CSTR(a) == MACRO_TO_CSTR(b))
#ifndef RLIB_MACRO_TO_CSTR
#define RLIB_MACRO_TO_CSTR(m) _RLIB_MACRO_ENSTRING(m)
#endif
#ifndef MACRO_CAT
#define MACRO_CAT(a, b) _MACRO_CAT_I(a, b)
#define _MACRO_CAT_I(a, b) _MACRO_CAT_II(~, a ## b)
#define _MACRO_CAT_II(p, res) res
//#ifndef RLIB_MACRO_EQL
//#define RLIB_MACRO_EQL(a, b) (RLIB_MACRO_TO_CSTR(a) == RLIB_MACRO_TO_CSTR(b))
//#endif
#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
#ifndef MAKE_UNIQUE_NAME
#define MAKE_UNIQUE_NAME(base) MACRO_CAT(base, __COUNTER__)
#ifndef RLIB_MAKE_UNIQUE_NAME
#define RLIB_MAKE_UNIQUE_NAME(base) RLIB_MACRO_CAT(base, __COUNTER__)
#endif
#endif
......@@ -47,7 +47,7 @@ namespace rlib {
#ifndef defer
#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
#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