Mercurial > hg > GearsTemplate
changeset 9:14c604cfa711
modify directories
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 02 Apr 2015 01:05:52 +0900 |
parents | 714d0ce1efd7 |
children | 88a4a95f5485 |
files | src/CMakeLists.txt src/allocate/CMakeLists.txt src/allocate/allocate.c src/allocate/allocate.h src/allocate/allocate_test.c src/allocate/allocate_test.h |
diffstat | 6 files changed, 57 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CMakeLists.txt Thu Apr 02 01:05:52 2015 +0900 @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +# set compiler +set(CMAKE_C_COMPILER $ENV{CbC_Clang}/clang) + +# compile option +add_definitions("-Wall -g -O0") + +include_directories(include) + +add_subdirectory(allocate) +#add_subdirectory(list)
--- a/src/allocate/CMakeLists.txt Wed Apr 01 22:56:51 2015 +0900 +++ b/src/allocate/CMakeLists.txt Thu Apr 02 01:05:52 2015 +0900 @@ -1,10 +1,5 @@ cmake_minimum_required(VERSION 2.8) -# compile option -add_definitions("-Wall -g -O0") -#add_library(allocate_lib STATIC allocate.c) add_executable(allocate allocate_test.c ) -#target_link_libraries(allocate allocate_lib) -set(CMAKE_C_COMPILER $ENV{CbC_Clang}/clang)
--- a/src/allocate/allocate.c Wed Apr 01 22:56:51 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#include <stdlib.h> - -#include "allocate.h" - -__code allocate(Context* context, int size, int num, __code (*next)()) { - goto meta_allocate(context, size, num, next); -} - -__code meta_allocate(Context* context, int size, int num, __code (*next)()) { - context->next = next; - void* ds = context->ds; - context->ds += size*num; - ((mdata*)context->mds)->ds = ds; - ((mdata*)context->mds)->size = size; - context->mds = (mdata*)context->mds+1; - goto context->next(context, (data1*)ds, 0); -}
--- a/src/allocate/allocate.h Wed Apr 01 22:56:51 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -typedef struct DataSegment1 { - int i; // 4 byte - char c[10]; // 10 byte - // padding 2 byte -} data1; - -typedef struct DataSegment2 { - int x; // 4 byte - int y; // 4 byte - int z; // 4 byte -} data2; - -typedef struct metaDataSegment { - size_t size; // 8 byte - void* ds; // 8 byte -} mdata; - -typedef struct Context_st { - void* ds; - void* mds; - void* ds_heap; - void* mds_heap; - __code (*next)(); -} Context; - -__code start_code(); -__code meta_start_code(); -__code code1(); -__code meta_code1(); -__code allocate(); -__code meta_allocate(); -__code code2(); -__code meta_code2(); -__code exit_code();
--- a/src/allocate/allocate_test.c Wed Apr 01 22:56:51 2015 +0900 +++ b/src/allocate/allocate_test.c Thu Apr 02 01:05:52 2015 +0900 @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> +#include "allocate_test.h" #include "allocate.h" #ifdef CLANG @@ -26,19 +27,19 @@ goto allocate(context, (int)sizeof(data1), NUM, code2); } -__code allocate(Context* context, int size, int num, __code (*next)()) { - goto meta_allocate(context, size, num, next); -} +/* __code allocate(Context* context, int size, int num, __code (*next)()) { */ +/* goto meta_allocate(context, size, num, next); */ +/* } */ -__code meta_allocate(Context* context, int size, int num, __code (*next)()) { - context->next = next; - void* ds = context->ds; - context->ds += size*num; - ((mdata*)context->mds)->ds = ds; - ((mdata*)context->mds)->size = size; - context->mds = (mdata*)context->mds+1; - goto context->next(context, (data1*)ds, 0); -} +/* __code meta_allocate(Context* context, int size, int num, __code (*next)()) { */ +/* context->next = next; */ +/* void* ds = context->ds; */ +/* context->ds += size*num; */ +/* ((mdata*)context->mds)->ds = ds; */ +/* ((mdata*)context->mds)->size = size; */ +/* context->mds = (mdata*)context->mds+1; */ +/* goto context->next(context, (data1*)ds, 0); */ +/* } */ __code code2(Context* context, data1* out, int loop) { out->i = loop;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/allocate/allocate_test.h Thu Apr 02 01:05:52 2015 +0900 @@ -0,0 +1,32 @@ +typedef struct DataSegment1 { + int i; // 4 byte + char c[10]; // 10 byte + // padding 2 byte +} data1; + +typedef struct DataSegment2 { + int x; // 4 byte + int y; // 4 byte + int z; // 4 byte +} data2; + +typedef struct metaDataSegment { + size_t size; // 8 byte + void* ds; // 8 byte +} mdata; + +typedef struct Context_st { + void* ds; + void* mds; + void* ds_heap; + void* mds_heap; + __code (*next)(); +} Context; + +__code start_code(); +__code meta_start_code(); +__code code1(); +__code meta_code1(); +__code code2(); +__code meta_code2(); +__code exit_code();