view final_pre/src/akashaMeta.c @ 7:28f900230c26

add final_pre
author ryokka
date Mon, 19 Feb 2018 23:32:24 +0900
parents
children
line wrap: on
line source

__code meta(struct Context* context, enum Code next) {
    struct Iterator* iter = &context->data[Iter]->iterator;

    switch (context->prev) {
        case GoToPreviousDepth:
            if (iter->iteratedPointDataNum == 0) break;
            if (iter->iteratedPointHeap == NULL) break;

            unsigned int diff =(unsigned long)context->heap - (unsigned long)iter->iteratedPointHeap;
            memset(iter->iteratedPointHeap, 0, diff);
            context->dataNum = iter->iteratedPointDataNum;
            context->heap    = iter->iteratedPointHeap;
            break;
        default:
            break;
    }
    switch (next) {
        case PutAndGoToNextDepth:   // with assert check
            if (context->prev == GoToPreviousDepth) break;
            if (iter->previousDepth == NULL)        break;
            iter->previousDepth->iteratedPointDataNum = context->dataNum;
            iter->previousDepth->iteratedPointHeap    = context->heap;
            break;
        default:
            break;
    }

    context->prev = next;
    goto (context->code[next])(context);
}