Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Loop and vars for tests of display commands |
2 | */ | |
3 | #include <stdio.h> | |
4 | #define LOOP 10 | |
5 | ||
6 | int sum = 0; | |
7 | ||
7cbcbded DJ |
8 | /* Call to force a variable onto the stack so we can see its address. */ |
9 | void force_mem (int *arg) { } | |
10 | ||
c906108c SS |
11 | int do_loops() |
12 | { | |
13 | int i=0; | |
14 | int k=0; | |
15 | int j=0; | |
739d0d99 | 16 | float f=3.1415; |
7cbcbded | 17 | for( i = 0; i < LOOP; i++ ) { /* set breakpoint 1 here */ |
c906108c SS |
18 | for( j = 0; j < LOOP; j++ ) { |
19 | for( k = 0; k < LOOP; k++ ) { | |
7cbcbded | 20 | sum++; f++; force_mem (&k); |
c906108c SS |
21 | } |
22 | } | |
23 | } | |
7cbcbded | 24 | return i; /* set breakpoint 2 here */ |
c906108c SS |
25 | } |
26 | ||
27 | int do_vars() | |
28 | { | |
29 | int j; | |
30 | int i = 9; | |
31 | float f = 1.234; | |
32 | char c = 'Q'; | |
33 | int *p_i = &i; | |
34 | float *p_f = &f; | |
35 | char *p_c = "rubarb and fries"; | |
36 | ||
37 | /* Need some code here to set breaks on. | |
38 | */ | |
39 | for( j = 0; j < LOOP; j++ ) { | |
7cbcbded | 40 | if( p_c[j] == c ) { /* set breakpoint 3 here */ |
c906108c SS |
41 | j++; |
42 | } | |
43 | else { | |
44 | i++; | |
45 | } | |
46 | } | |
47 | ||
48 | return *p_i; | |
49 | } | |
50 | ||
51 | main() | |
52 | { | |
53 | do_loops(); | |
54 | do_vars(); | |
55 | } |