Mercurial > hg > GearsTemplate
view src/allocate/allocate.c @ 11:a4f351b66544
implement appned
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 02 Apr 2015 22:55:05 +0900 |
parents | 88a4a95f5485 |
children | d98961bfd0f2 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "prototype.h" #include "context.h" #include "allocate.h" #include "origin_cs.h" #ifdef CLANG #define _CbC_retrun __return #define _CbC_environment __environment #endif #define NUM 100 __code code1(Context* context) { goto meta_code1(context); } __code meta_code1(Context* context) { goto allocate(context, (int)sizeof(data1), NUM, code2); } __code code2(Context* context, data1* ds) { goto meta_code2(context, ds); } __code meta_code2(Context* context, data1* ds) { goto code3(context, ds, 0); } __code code3(Context* context, data1* out, int loop) { out->i = loop; if (loop == NUM) { goto meta_code3(context); } printf("%d\n",out->i); goto code3(context, out+1, loop+1); } __code meta_code3(Context* context) { goto exit_code(context); } int main() { Context* context = (Context*)malloc(sizeof(Context)); context->ds_heap = malloc(sizeof(data1)*1024); context->mds_heap = malloc(sizeof(mdata)*1024); context->ds = context->ds_heap; context->mds = context->mds_heap; goto start_code(context, code1); }