| author | huffman | 
| Thu, 25 Aug 2011 11:57:42 -0700 | |
| changeset 44521 | 083eedb37a37 | 
| parent 41616 | aa002926cbf1 | 
| child 47868 | 32c03d45fffe | 
| permissions | -rw-r--r-- | 
| 4501 | 1  | 
#  | 
| 9789 | 2  | 
# Author: Markus Wenzel, TU Muenchen  | 
| 4501 | 3  | 
#  | 
4  | 
# feeder.pl - feed isabelle session  | 
|
5  | 
#  | 
|
6  | 
||
7  | 
# args  | 
|
8  | 
||
| 12111 | 9  | 
($head, $emitpid, $quit, $tail) = @ARGV;  | 
| 4501 | 10  | 
|
11  | 
||
| 4504 | 12  | 
# setup signal handlers  | 
| 4501 | 13  | 
|
| 4504 | 14  | 
sub hangup { exit(0); }
 | 
| 4501 | 15  | 
$SIG{'HUP'} = "hangup";
 | 
| 4504 | 16  | 
$SIG{'INT'} = "IGNORE";
 | 
| 4501 | 17  | 
|
18  | 
||
19  | 
# main  | 
|
20  | 
||
21  | 
#buffer lines  | 
|
22  | 
$| = 1;  | 
|
23  | 
||
24  | 
||
25  | 
$emitpid && (print $$, "\n");  | 
|
26  | 
||
| 
40335
 
3e4bb6e7c3ca
feeder: treat header as escaped utf8 to allow initial ML text to refer to non-ASCII file/directory names (e.g. "Documents/" on Chinese Ubuntu);
 
wenzelm 
parents: 
39580 
diff
changeset
 | 
27  | 
if ($head) {
 | 
| 
41616
 
aa002926cbf1
potentially more robust utf8 handling (cf. 3e4bb6e7c3ca);
 
wenzelm 
parents: 
40335 
diff
changeset
 | 
28  | 
utf8::upgrade($head);  | 
| 
40335
 
3e4bb6e7c3ca
feeder: treat header as escaped utf8 to allow initial ML text to refer to non-ASCII file/directory names (e.g. "Documents/" on Chinese Ubuntu);
 
wenzelm 
parents: 
39580 
diff
changeset
 | 
29  | 
  $head =~ s/([\x80-\xff])/\\${\(ord($1))}/g;
 | 
| 
 
3e4bb6e7c3ca
feeder: treat header as escaped utf8 to allow initial ML text to refer to non-ASCII file/directory names (e.g. "Documents/" on Chinese Ubuntu);
 
wenzelm 
parents: 
39580 
diff
changeset
 | 
30  | 
print $head, "\n";  | 
| 
 
3e4bb6e7c3ca
feeder: treat header as escaped utf8 to allow initial ML text to refer to non-ASCII file/directory names (e.g. "Documents/" on Chinese Ubuntu);
 
wenzelm 
parents: 
39580 
diff
changeset
 | 
31  | 
}  | 
| 4501 | 32  | 
|
33  | 
if (!$quit) {
 | 
|
| 39580 | 34  | 
  while (<STDIN>) {
 | 
35  | 
print;  | 
|
36  | 
}  | 
|
| 4501 | 37  | 
}  | 
38  | 
||
39  | 
$tail && (print "$tail", "\n");  | 
|
40  | 
||
41  | 
||
| 4504 | 42  | 
# wait forever  | 
| 4501 | 43  | 
|
44  | 
close STDOUT;  | 
|
45  | 
sleep;  |