view paper/source/allocate.h @ 20:bb2bf03f09b4 default tip

add graffle files
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Thu, 04 Feb 2016 17:28:04 +0900
parents 92f7c78d8d6c
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
}