remove definition of _ which conflicts with other libraries, e.g. PLOOC

This commit is contained in:
Gabriel Wang 2021-03-24 10:49:06 +00:00
parent 7c35545e07
commit c2aa5423c6
5 changed files with 22 additions and 23 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ example/Out/perf_counter.lib
*.iex
*.crf
*.lst
example/example.uvguix.gabriel

View File

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
@ -325,7 +325,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>

View File

@ -77,20 +77,20 @@ int main (void)
/*! demo of __cycleof__() operation */
__cycleof__() {
foreach(example_lv0_t, s_tItem) {
printf("Processing item with ID = %d\r\n", _.chID);
printf("Processing item with ID = %d\r\n", _->chID);
}
}
/*! demo of with block */
with(example_lv0_t, &s_tItem[0], pitem) {
_.wA = 1;
_.hwB = 2;
_.chC = 3;
_->wA = 1;
_->hwB = 2;
_->chC = 3;
with(example_lv1_t, &pitem->tLV1) {
_.wLV1A = 4;
_.hwLV1B = 5;
_.chLV1C = 6;
_->wLV1A = 4;
_->hwLV1B = 5;
_->chLV1C = 6;
}
}

View File

@ -96,32 +96,31 @@
__set_PRIMASK(CONNECT2(temp,__LINE__)))
#define __with2(__type, __addr) \
using(__type *_p=(__addr))
using(__type *_=(__addr))
#define __with3(__type, __addr, __item) \
using(__type *_p=(__addr), *__item = _p, _p=_p, )
using(__type *_=(__addr), *__item = _, _=_, )
#define with(...) \
CONNECT2(__with, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#undef _
#define _ (*_p)
#ifndef dimof
# define dimof(__array) (sizeof(__array)/sizeof(__array[0]))
#endif
#define foreach2(__type, __array) \
using(__type *_p = __array) \
using(__type *_ = __array) \
for ( uint_fast32_t CONNECT2(count,__LINE__) = dimof(__array); \
CONNECT2(count,__LINE__) > 0; \
_p++, CONNECT2(count,__LINE__)-- \
_++, CONNECT2(count,__LINE__)-- \
)
#define foreach3(__type, __array, __item) \
using(__type *_p = __array, *__item = _p, _p = _p, ) \
using(__type *_ = __array, *__item = _, _ = _, ) \
for ( uint_fast32_t CONNECT2(count,__LINE__) = dimof(__array); \
CONNECT2(count,__LINE__) > 0; \
_p++, __item = _p, CONNECT2(count,__LINE__)-- \
_++, __item = _, CONNECT2(count,__LINE__)-- \
)
#define foreach(...) \

View File

@ -96,32 +96,31 @@
__set_PRIMASK(CONNECT2(temp,__LINE__)))
#define __with2(__type, __addr) \
using(__type *_p=(__addr))
using(__type *_=(__addr))
#define __with3(__type, __addr, __item) \
using(__type *_p=(__addr), *__item = _p, _p=_p, )
using(__type *_=(__addr), *__item = _, _=_, )
#define with(...) \
CONNECT2(__with, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#undef _
#define _ (*_p)
#ifndef dimof
# define dimof(__array) (sizeof(__array)/sizeof(__array[0]))
#endif
#define foreach2(__type, __array) \
using(__type *_p = __array) \
using(__type *_ = __array) \
for ( uint_fast32_t CONNECT2(count,__LINE__) = dimof(__array); \
CONNECT2(count,__LINE__) > 0; \
_p++, CONNECT2(count,__LINE__)-- \
_++, CONNECT2(count,__LINE__)-- \
)
#define foreach3(__type, __array, __item) \
using(__type *_p = __array, *__item = _p, _p = _p, ) \
using(__type *_ = __array, *__item = _, _ = _, ) \
for ( uint_fast32_t CONNECT2(count,__LINE__) = dimof(__array); \
CONNECT2(count,__LINE__) > 0; \
_p++, __item = _p, CONNECT2(count,__LINE__)-- \
_++, __item = _, CONNECT2(count,__LINE__)-- \
)
#define foreach(...) \