view paper/source/allocate.h @ 10:92f7c78d8d6c

edit
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 06 May 2015 19:55:44 +0900
parents bb5fab31cf41
children
line wrap: on
line source

// Code Gear
__code code1(struct Context* context) {
    context->data[Allocate]->allocate.size = sizeof(struct Node);
    context->data[Allocate]->allocate.next = Code2;
    goto meta(context, Allocate);
}

// Meta Code Gear
__code meta(struct Context* context, enum Code next) {
    // meta computation
    goto (context->code[next])(context);
}

// Meta Code Gear
__code allocate(struct Context* context) {
    context->data[++context->dataNum] = context->heap;
    context->heap += context->data[Allocate]->allocate.size;
    goto (context->code[context->data[Allocate]->allocate.next])(context);
}

// Code Gear
__code code2(struct Context* context) {
    // processing content
}