comparison examples/calculator/main.c @ 93:c3c41f88e776

-
author Thinker K.F. Li <thinker@branda.to>
date Sun, 24 Aug 2008 01:18:58 +0800
parents 3f619ae03678
children 57f8fecca8f3
comparison
equal deleted inserted replaced
92:3f619ae03678 93:c3c41f88e776
45 break; 45 break;
46 case '*': 46 case '*':
47 r = v1 * v2; 47 r = v1 * v2;
48 break; 48 break;
49 case '/': 49 case '/':
50 r = v1;
50 if(v2) 51 if(v2)
51 r = v1 / v2; 52 r /= v2;
52 else
53 r = v1;
54 break; 53 break;
55 case 'n': 54 case 'n':
56 r = v2; 55 r = v2;
57 break; 56 break;
58 case 'N': 57 case 'N':
159 calculator_scr = ex_rt->code; 158 calculator_scr = ex_rt->code;
160 factory = rdman_get_ob_factory(ex_rt->rt->rdman); 159 factory = rdman_get_ob_factory(ex_rt->rt->rdman);
161 160
162 for(i = 0; i < 16; i++) { 161 for(i = 0; i < 16; i++) {
163 off = tgt_list[i].off; 162 off = tgt_list[i].off;
164 coord = *(coord_t **)((void *)calculator_scr + off); 163 coord = OFF2TYPE(calculator_scr, off, coord_t *);
165 subject = coord_get_mouse_event(coord); 164 subject = coord_get_mouse_event(coord);
166 subject_add_observer(factory, subject, buttons_handler, ex_rt); 165 subject_add_observer(factory, subject, buttons_handler, ex_rt);
167 } 166 }
168 } 167 }
169 168