tokuhirom (owner)

Fork Of

Revisions

gist: 188423 Download_button fork
public
Public Clone URL: git://gist.github.com/188423.git
Embed All Files: show embed
hello.as #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.section .data
  message:
    .ascii "<title>hok</title>\n"
 
.section .text
  .global _start
  _start:
    movl $4,%eax
    movl $1,%ebx
    movl $message,%ecx
    movl $19,%edx
    int $0x80
 
  _exit:
    movl $1,%eax
    movl $0,%ebx
    int $0x80
 
hello.txt #
1
2
 
 
Makefile #
1
2
3
4
hello.txt: hello.as
as -o hello.o hello.as
ld -o hello.txt hello.o
 
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mattn: pipe() は Perl の場合、win32 でもうごきますか?
 
動きます。
 
-----------------------------------------
#!/usr/bin/perl -w
 
use IO::Handle;
 
pipe(PARENTREAD, PARENTWRITE);
pipe(CHILDREAD, CHILDWRITE);
 
PARENTWRITE->autoflush(1);
CHILDWRITE->autoflush(1);
 
if ($child = fork) {
   close CHILDREAD;
   close PARENTWRITE;
   print CHILDWRITE "34+56;\n";
   chomp($result = <PARENTREAD>);
   print "白ヤギさんから答えが来た: $result\n";
   close PARENTREAD;
   close CHILDWRITE;
   waitpid($child,0);
} else {
   close PARENTREAD;
   close CHILDWRITE;
   chomp($calculation = <CHILDREAD>);
   print "黒ヤギさんから計算式来た: $calculation\n";
   $result = eval "$calculation";
   print PARENTWRITE "$result\n";
   close CHILDREAD;
   close PARENTWRITE;
   exit;
}
 
おお。すばらしい。ありがとうございます! -- tokuhirom