+added a generic iterator type.

This commit is contained in:
paladin-t 2016-02-18 11:07:04 +08:00
parent 8020927963
commit 4a715f8ea8
4 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,6 @@
Feb. 18 2016
Added a generic iterator type
Feb. 16 2016
Fixed a bug of the EXIT statement with FOR loop

View File

@ -11334,6 +11334,8 @@ const char* mb_get_type_string(mb_data_e t) {
return "DICT_ITERATOR";
case MB_DT_COLLECTION:
return "COLLECTION";
case MB_DT_ITERATOR:
return "ITERATOR";
#endif /* MB_ENABLE_COLLECTION_LIB */
#ifdef MB_ENABLE_CLASS
case MB_DT_CLASS:
@ -13425,6 +13427,7 @@ static int _core_type(mb_interpreter_t* s, void** l) {
MB_DT_DICT,
MB_DT_DICT_IT,
MB_DT_COLLECTION,
MB_DT_ITERATOR,
#endif /* MB_ENABLE_COLLECTION_LIB */
#ifdef MB_ENABLE_CLASS
MB_DT_CLASS,

View File

@ -372,6 +372,7 @@ typedef enum mb_data_e {
MB_DT_DICT = 1 << 10,
MB_DT_DICT_IT = 1 << 11,
MB_DT_COLLECTION = MB_DT_LIST | MB_DT_DICT,
MB_DT_ITERATOR = MB_DT_LIST_IT | MB_DT_DICT_IT,
#endif /* MB_ENABLE_COLLECTION_LIB */
#ifdef MB_ENABLE_CLASS
MB_DT_CLASS = 1 << 12,

View File

@ -1087,7 +1087,9 @@ static int_t _ticks(void) {
static int_t _ticks(void) {
struct timespec ts;
struct timeval now;
int rv = gettimeofday(&now, NULL);
int rv = 0;
rv = gettimeofday(&now, 0);
if(rv) return 0;
ts.tv_sec = now.tv_sec;
ts.tv_nsec = now.tv_usec * 1000;