unleashed-firmware/core/furi/dangerous_defines.h
Albert Kharisov 84410c83b5
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment

Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 12:20:41 +03:00

45 lines
1.8 KiB
C

#pragma once
/** Assign value to variable with const modifier
*
* This macros is equivalent to `const_cast` from C++
* Literally x = y, but with some magic.
* It's as dangerous as only can be.
* We don't advice you to use it unless you REALLY MUST.
* Like REALLY REALLY.
*
* @param x - const variable
* @param y - variable
*
* @return assigned variable value
*/
#ifndef FURI_CONST_ASSIGN
#define FURI_CONST_ASSIGN_(T, x, y) \
({ \
T* tmp_x = (T*)&x; \
*tmp_x = y; \
*tmp_x; \
})
#define FURI_CONST_ASSIGN_PTR(x, y) \
({ \
void** tmp_x = (void**)&x; \
*tmp_x = y; \
*tmp_x; \
})
#define FURI_CONST_ASSIGN(x, y) \
_Generic((x), signed char \
: FURI_CONST_ASSIGN_(signed char, x, y), unsigned char \
: FURI_CONST_ASSIGN_(unsigned char, x, y), short \
: FURI_CONST_ASSIGN_(short, x, y), unsigned short \
: FURI_CONST_ASSIGN_(unsigned short, x, y), int \
: FURI_CONST_ASSIGN_(int, x, y), unsigned \
: FURI_CONST_ASSIGN_(unsigned, x, y), long \
: FURI_CONST_ASSIGN_(long, x, y), unsigned long \
: FURI_CONST_ASSIGN_(unsigned long, x, y), long long \
: FURI_CONST_ASSIGN_(long long, x, y), unsigned long long \
: FURI_CONST_ASSIGN_(unsigned long long, x, y), float \
: FURI_CONST_ASSIGN_(float, x, y), double \
: FURI_CONST_ASSIGN_(double, x, y), long double \
: FURI_CONST_ASSIGN_(long double, x, y))
#endif