Mercurial > hg > Papers > 2016 > atton-ipsjpro
view paper/src/ds.c @ 28:3e4a390a9c40
Add original sample sources
author | atton |
---|---|
date | Tue, 05 Jul 2016 09:47:13 +0000 |
parents | |
children |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> union Data { struct Count { int x; } count; struct Port { unsigned int port; } port; }; __code addTen_stub(union Data* ds) { goto addTen(ds, ds->count.x); } __code addTen(union Data* ds, int a) { int b = a+10; goto twice_stub(ds); } __code twice_stub(union Data* dataSegment) { goto twice(dataSegment->count.x); } __code twice(int x) { int y = 2*x; goto showValue(y); } __code showValue(int z) { printf("%d", z); exit(0); } int main(int argc, char* argv[]) { union Data* ds = malloc(sizeof(union Data)); ds->count.x = 22; goto addTen_stub(ds); }