Wild Life: interrupt.c File Reference

Wild Life 2.29

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros
Functions | Variables
interrupt.c File Reference

Go to the source code of this file.

## Functions
void | interrupt ()
void | init_interrupt ()
void | handle_interrupt ()

## Variables
long | interrupted =FALSE

## Function Documentation

void handle_interrupt | ( |  | ) |

Definition at line 43 of file interrupt.c.

References abort_life(), DIGIT, EOLN, exit_life(), FALSE, input_state, interrupted, open_input_file(), prompt, quietflag, read_char(), restore_state(), show_count(), stdin_cleareof(), stepcount, stepflag, steptrace, trace, TRUE, and verbose.

44 {
45 ptr_psi_term old_state_loc;
46 char *old_prompt;
47 int old_quiet; /* 21.1 */
48 long c,d; /* 21.12 (prev. char) */
49 long count;
50
51 if (interrupted) printf("\n");
52 interrupted=FALSE;
53 old_prompt=prompt;
54 old_quiet=quietflag; /* 21.1 */
55 steptrace=FALSE;
56
57 /* new_state(&old_state_loc); */
58 old_state_loc=input_state;
59 (void)open_input_file("stdin");
60 stdin_cleareof();
61
62 StartAgain:
63 do {
64 printf("*** Command ");
65 prompt="(q,c,a,s,t,h)?";
66 quietflag=FALSE; /* 21.1 */
67
68 do {
69 c=read_char();
70 } while (c!=EOLN && c>0 && c<=32);
71
72 d=c;
73 count=0;
74 while (DIGIT(d)) { count=count*10+(d-'0'); d=read_char(); }
75
76 while (d!=EOLN && d!=EOF) d=read_char();
77
78 if (c=='h' || c=='?') {
79 printf("*** [Quit (q), Continue (c), Abort (a), Step (s,RETURN), Trace (t), Help (h,?)]\n");
80 }
81
82 } while (c=='h' || c=='?');
83
84 prompt=old_prompt;
85 quietflag=old_quiet; /* 21.1 */
86
87 switch (c) {
88 case 'v':
89 case 'V':
90 verbose=TRUE;
91 break;
92 case 'q':
93 case 'Q':
94 case EOF:
95 if (c==EOF) printf("\n");
96 exit_life(FALSE);
97 break;
98 case 'a':
99 case 'A':
100 (void)abort_life(FALSE);
101 show_count();
102 break;
103 case 'c':
104 case 'C':
105 trace=FALSE;
106 stepflag=FALSE;
107 break;
108 case 't':
109 case 'T':
110 trace=TRUE;
111 stepflag=FALSE;
112 break;
113 case 's':
114 case 'S':
115 case EOLN:
116 trace=TRUE;
117 stepflag=TRUE;
118 break;
119 case '0': case '1': case '2': case '3': case '4':
120 case '5': case '6': case '7': case '8': case '9':
121 trace=TRUE;
122 stepflag=TRUE;
123 if (count>0) {
124 stepcount=count;
125 stepflag=FALSE;
126 }
127 break;
128 default:
129 goto StartAgain;
130 }
131 input_state=old_state_loc;
132 restore_state(input_state);
133 }
exit_life
void exit_life(long nl_flag)
Definition: built_ins.c:2090
verbose
long verbose
Definition: def_glob.h:273
wl_psi_term
Definition: def_struct.h:161
DIGIT
#define DIGIT(C)
Definition: def_macro.h:37
quietflag
long quietflag
Definition: def_glob.h:271
show_count
void show_count()
Definition: login.c:1085
input_state
ptr_psi_term input_state
Definition: def_glob.h:199
steptrace
long steptrace
Definition: def_glob.h:274
abort_life
long abort_life(int nlflag)
Definition: built_ins.c:2124
trace
long trace
Definition: def_glob.h:272
stepcount
long stepcount
Definition: def_glob.h:275
EOLN
#define EOLN
Definition: def_const.h:140
TRUE
#define TRUE
Definition: def_const.h:127
FALSE
#define FALSE
Definition: def_const.h:128
stepflag
long stepflag
Definition: def_glob.h:150
restore_state
void restore_state(ptr_psi_term t)
Definition: token.c:267
prompt
char * prompt
Definition: def_glob.h:42
read_char
long read_char()
Definition: token.c:587
interrupted
long interrupted
Definition: interrupt.c:8
stdin_cleareof
void stdin_cleareof()
Definition: token.c:42
open_input_file
long open_input_file(char *file)
Definition: token.c:504

void init_interrupt | ( |  | ) |

Definition at line 28 of file interrupt.c.

References interrupt().

29 {
30 void (*f)(); /* RM: Apr 7 1993 Weird problem in GCC and C89 */
31 f=interrupt;
32 if (signal(SIGINT,SIG_IGN)!=SIG_IGN)
33 (void)signal(SIGINT,f);
34 }
interrupt
void interrupt()
Definition: interrupt.c:13

void interrupt | ( |  | ) |

Definition at line 13 of file interrupt.c.

References interrupted, and TRUE.

14 {
15 void (*f)(); /* RM: Apr 7 1993 Weird problem in GCC and C89 */
16
17 interrupted=TRUE;
18 f=interrupt;
19 (void)signal(SIGINT,f);/* RM: Feb 15 1993 */
20 }
interrupt
void interrupt()
Definition: interrupt.c:13
TRUE
#define TRUE
Definition: def_const.h:127
interrupted
long interrupted
Definition: interrupt.c:8

## Variable Documentation

long interrupted =FALSE

Definition at line 8 of file interrupt.c.