4coder/meta/4ed_meta_defines.h

49 lines
1019 B
C
Raw Normal View History

/*
* Mr. 4th Dimention - Allen Webster
*
* 21.01.2017
*
* Header to setup metaprograms.
*
*/
// TOP
#if !defined(FTECH_META_DEFINES_H)
#define FTECH_META_DEFINES_H
#include <setjmp.h>
#include <stdio.h>
global jmp_buf META_ASSERT_ENV;
global char* META_ASSERT_MSG;
internal void
__meta_finish__(){
if (META_ASSERT_MSG != 0){
printf("%s\n", META_ASSERT_MSG);
}
}
#define META_FINISH() } __META_FINISH__: __meta_finish__()
#if defined(Assert)
# undef Assert
#endif
2019-06-01 23:58:28 +00:00
#define Assert(c) do { if (!(c)) { META_ASSERT_MSG = FNLN " assert: " #c; longjmp(META_ASSERT_ENV, 1); } } while(0)
#define META_BEGIN() META_ASSERT_MSG = 0; if (setjmp(META_ASSERT_ENV) == 1){ goto __META_FINISH__; } {
char STANDARD_DISCLAIMER[] =
"no warranty implied; use at your own risk\n"
"\n"
"This software is in the public domain. Where that dedication is not\n"
"recognized, you are granted a perpetual, irrevocable license to copy,\n"
"distribute, and modify this file as you see fit.\n\n";
#endif
// BOTTOM