view paper/src/context.h @ 16:958634b9fa32

make paper directory
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 17 Feb 2016 16:59:46 +0900
parents src/context.h@910e143c28e7
children bb06d3fa6689
line wrap: on
line source

/* Context definition example */
#define ALLOCATE_SIZE 1000

// Code Gear Name
enum Code {
    Code1,
    Code2,
    Allocator,
    Exit,
};

// Unique Data Gear
enum UniqueData {
    Allocate,
};

struct Context {
    enum Code next;
    int codeNum;
    __code (**code) (struct Context*);
    void* heapStart;
    void* heap;
    long heapLimit;
    int dataNum;
    union Data **data;
};

// Data Gear definition
union Data {
    // size: 4 byte
    struct Data1 {
        int i;
    } data1;
    // size: 5 byte
    struct Data2 {
        int i;
        char c;
    } data2;
    // size: 8 byte
    struct Allocate {
        long size;
    } allocate;
};