Listing 5 (reptest. cpp)

 1: /*
 2: REPTEST.CPP
 3:
 4: Source for example repetition rate program.
 5: Paul A. Cornelius, August 1991
 6: */
 7:
 8: #include "reprate.hpp"
 9: #include <disp.h>
10: #include <stdio.h>
11: #include <sound.h>
12: #include <bios.h>
13:
14: static long tix1,tix2;
15: void ch0()
16: {
17:     sound_click();
18:     tix1++;
19: }
20:
21: void ch1()
22: {
23:     tix2++;
24: }
25:
26: void show_objects()
27: {
28:     // loop until key is pressed
29:     while (bioskey(1) == O)
30:     {
31:         disp_move(2,0);
32:         disp_printf("%8ld %8ld",tix1,tix2);
33:     }
34:     // remove keypress from buffer
35:     getch();
36: }
37:
38: int main()
39: {
40:     // open Zortech display package
41:     disp_open();
42:     disp_move(0,0);
43:     disp_setattr(15);
44:     disp_eeop();
45:     RepRate ticker0(100.0,&ch0),ticker1(1.0,&ch1);
46:     disp_move(5,0);
47:     disp_printf("Rep rates: %.2f %.2f",
48:      ticker0.GetRepRate(),ticker1.GetRepRate());
49:
50:     show_objects();
51:     TimerList. Linkin(&ticker0);
52:     show_objects();
53:     TimerList. Linkin(&ticker1);
54:     show_objects();
55:     TimerList.Linkout(&ticker1);
56:     show_objects();
57:
58:     return 0;
59: }
60:
// End of File