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; |
9d8fa392 PA |
17 | int *p_i = &i; |
18 | ||
7cbcbded | 19 | for( i = 0; i < LOOP; i++ ) { /* set breakpoint 1 here */ |
c906108c SS |
20 | for( j = 0; j < LOOP; j++ ) { |
21 | for( k = 0; k < LOOP; k++ ) { | |
7cbcbded | 22 | sum++; f++; force_mem (&k); |
c906108c SS |
23 | } |
24 | } | |
25 | } | |
7cbcbded | 26 | return i; /* set breakpoint 2 here */ |
c906108c SS |
27 | } |
28 | ||
29 | int do_vars() | |
30 | { | |
31 | int j; | |
32 | int i = 9; | |
33 | float f = 1.234; | |
34 | char c = 'Q'; | |
35 | int *p_i = &i; | |
36 | float *p_f = &f; | |
37 | char *p_c = "rubarb and fries"; | |
38 | ||
39 | /* Need some code here to set breaks on. | |
40 | */ | |
41 | for( j = 0; j < LOOP; j++ ) { | |
7cbcbded | 42 | if( p_c[j] == c ) { /* set breakpoint 3 here */ |
c906108c SS |
43 | j++; |
44 | } | |
45 | else { | |
46 | i++; | |
47 | } | |
48 | } | |
49 | ||
50 | return *p_i; | |
51 | } | |
52 | ||
53 | main() | |
54 | { | |
55 | do_loops(); | |
56 | do_vars(); | |
57 | } |