Mercurial > hg > Gears > Gears
view src/parallel_execution/examples/helloWorld/HelloImpl.cbc @ 972:6a9ad3da2daf
tweak HelloWorld
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Jun 2021 22:00:21 +0900 |
parents | edbd4495f08f |
children | 793b21a8ea12 |
line wrap: on
line source
#include "../../../context.h" #include <stdio.h> #impl "Hello.h" as "HelloImpl.h" #interface "Hello.h" // ---- // typedef struct HelloImpl <> impl Hello { // char* hString; // char* wString; // } HelloImpl; // ---- Hello* createHelloImpl(struct Context* context) { struct Hello* hello = new Hello(); struct HelloImpl* hello_impl = new HelloImpl(); hello->hello = (union Data*)hello_impl; hello->string = NULL; hello_impl->hString = NULL; hello_impl->wString = NULL; hello->h = C_hHelloImpl; hello->w = C_wHelloImpl; return hello; } __code h(struct HelloImpl* hello, __code next(...)) { hello->hString = "Hello, "; //createImpl部分では_implなのだが動く printf("%s", hello->hString); goto w(hello, next); } __code w(struct HelloImpl* hello, __code next(...)) { hello->wString = "World.\n"; printf("%s", hello->wString); goto next(...); }