annotate target-utils/c139-lldbg/mygetchar.c @ 968:2d986b8c0e4e

doc/Compiling: added explanation of extra host tools with library dependencies
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 07 Nov 2015 04:53:24 +0000
parents d7830aee0d35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
955
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * The interactive command entry (editing) function in libcommon
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * will call mygetchar() for its character input. It is supposed
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 * to be a blocking wait for input, but in some programs other
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 * processing can be done while waiting - for example, check for
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 * keypad presses as well. This is the basic version which waits
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 * for serial input and nothing else.
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 */
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 extern int serial_in_poll();
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 int
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 mygetchar()
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 {
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 register int c;
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 do
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 c = serial_in_poll();
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 while (c < 0);
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 return c;
d7830aee0d35 c139-lldbg hack concocted
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 }