From: xchaos Date: Fri, 2 Dec 2011 17:11:30 +0000 (+0000) Subject: preliminary draft of manufacture(...) {} macro X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=8071c0c8d4761ff6b7f313c1d1648aad08154cf6;p=svn%2FCll1h%2F.git preliminary draft of manufacture(...) {} macro git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@136 4bb87942-c103-4e5a-b51c-0ebff58f8515 --- diff --git a/crl1.h b/crl1.h index 54bf055..9d12b47 100644 --- a/crl1.h +++ b/crl1.h @@ -154,6 +154,7 @@ unsigned RANDOM_SEED=0; #define repeat(N) for(int _i=0,_j=(N); _i++<_j;) #define for_each(ONE_T,ONE,ALL_T,...) for(_init_##ONE_T##_##ALL_T(_head_##ONE_T##_##ALL_T(ONE,__VA_ARGS__));_test_##ONE_T##_##ALL_T(ONE,__VA_ARGS__) || _free_##ONE_T##_##ALL_T(ONE,__VA_ARGS__);_next_##ONE_T##_##ALL_T(ONE,__VA_ARGS__)) #define count(ONE_T,ALL_T,...) _count_##ONE_T##_##ALL_T(__VA_ARGS__) +#define manufacture(OUT_T,OUT,ONE_T,ONE,ALL_T,...) if(_start_##ONE_T##OUT_T##_(OUT,count(ONE_T,ALL_T,__VA_ARGS__))) for_each(ONE_T,ONE,ALL_T,__VA_ARGS__) if(_append_##ONE_T##OUT_T##_(ONE)) #define _init_char_str(...) str _s=(__VA_ARGS__) #define _head_char_str(ONE,ALL) ONE=(ALL?*ALL:0),ALL #define _test_char_str(ONE,...) ONE