view src/context.h @ 5:910e143c28e7

modify style
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 09 Feb 2016 17:10:44 +0900
parents 52eec0b77576
children
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;
};