view paper/src/gneratedPhils.cbc @ 111:4642d2f215d2

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sat, 06 Feb 2021 15:42:26 +0900
parents 04a6b05666c1
children
line wrap: on
line source

#include "../../../context.h"
#interface "Phils.h"

// ----
// typedef struct PhilsImpl <> impl Phils {
//   int self;
//   struct AtomicT_int* Leftfork;
//   struct AtomicT_int* Rightfork;
//   __code next(...);
// } PhilsImpl;
// ----

Phils* createPhilsImpl(struct Context* context) {
    struct Phils* phils  = new Phils();
    struct PhilsImpl* phils_impl = new PhilsImpl();
    phils->phils = (union Data*)phils_impl;
    phils_impl->self = 0;
    phils_impl->Leftfork = NULL;
    phils_impl->Rightfork = NULL;
    phils->putdown_lfork = C_putdown_lforkPhilsImpl;
    phils->putdown_rfork = C_putdown_rforkPhilsImpl;
    phils->thinking = C_thinkingPhilsImpl;
    phils->pickup_rfork = C_pickup_rforkPhilsImpl;
    phils->pickup_lfork = C_pickup_lforkPhilsImpl;
    phils->eating = C_eatingPhilsImpl;
    return phils;
}
__code putdown_lfork(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}

__code putdown_rfork(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}

__code thinking(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}

__code pickup_rfork(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}

__code pickup_lfork(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}

__code eating(struct PhilsImpl* phils, __code next(...)) {

    goto next(...);
}