annotate tmpa.c @ 25:6324b8df04f1

lj_as2: fix segmentation fault
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Sun, 31 Jan 2016 21:44:55 +0900
parents 35d6eabeadb0
children 586096c45873
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 #ifdef GCC
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #define __environment _CbC_environment
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #define __return _CbC_return
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
4 #endif
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #include <stdio.h>
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 struct enemy{
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
9 int charno; // image number
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
10 float x; // x location
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
11 float y; // y location
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
12 int ap; // armor point
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 };
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 void
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 print_param(struct enemy *e)
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 {
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
17 printf("#0014:charno:%d x,y:%f,%f hp:%d\n",
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
18 e->charno,e->x,e->y,e->ap);
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 typedef struct{
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
22 char dest;
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
23 int VF01[4];
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
24 __code (*ret)(int,void*);
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
25 void *env;
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 } interface;
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 __code a0(interface a) {
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29 printf("#0026:%d\n",a.dest);
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
30 goto a.ret(0,a.env);
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 int main(int argc,char *argv[])
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 {
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 struct enemy e;
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 #if 0
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 interface args = {15,{0,0,0,0},return,environment};
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 #else
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 interface args = {15,{0,0,0,0},0,0};
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41 args.ret = __return;
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
42 args.env = __environment;
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 #endif
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
45 e.charno=5; e.x=50.0; e.y=30.0; e.ap=100;
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
46 print_param(&e);
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
2
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 printf("#0045:%d %d\n",args.VF01[2],args.VF01[1]);
35d6eabeadb0 modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
49 goto a0(args);
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51