
%$B$3$N%a%$%k$OF|K\8lHG$NA4>O$r4^$s$G$$$^$9!%Aw$j$^$9!%G0$N$?$a!$$=$N8e$N(B
%$B%a%$%k$G3F>OKh$KAw$j$^$9!%(B

%This mail contains all chapters of Japanese manual. In the following
%mails, I will send each chapter one by one for the sake of redundancy.

%--------------------< manJ.tex >---------------------------
% Document Type: LaTeX
% Master File: manJ.tex
\documentstyle[12pt]{jreport}

\title{\LARGE\dg\bf PIMOS$BB.=$%^%K%e%"%k(B\\
	\Large\dg\bf ($BBh(B1.5$BHG(B)}
\author{(ICOT~~TM--883)}
\date{}
\begin{document}
\newcommand{\outarg}{\^{}}
\maketitle
\newpage
\baselineskip=0.5cm
\tableofcontents
\chapter{$B$O$8$a$K(B}
\label{chap:intro}

$BK\=q$O=i$a$F(B PIMOS $B$r;H$&%f!<%6$NJ}!9$,(B KL1 $B%W%m%0%i%`$r:n@.$7!$(BPIMOS
1.5 $BHG>e$G$=$N%W%m%0%i%`$r<B9T$G$-$k$h$&$K$J$k$?$a$NF~Lg=q$H$7$F=q$+$l(B
$B$F$$$^$9!%K\=q$G$O!$(BPIMOS$B$N=i4|@_Dj$+$i5/F0!$(BKL1$B%W%m%0%i%`$N:n@.$+$i!$(B
$B$=$N<B9T!$%G%P%C%0!$$=$7$F@-G=I>2A$K;j$k0lO"$NA`:n$NN.$l$r6qBNE*$JNc$K(B
$B$h$C$F@bL@$7$^$9!%(BPIMOS$B$N3F<o$N5!G=$K$D$$$F$b4JC1$K>R2p$7$F$"$j$^$9!%(B
$BK\=q$rFI$s$@8e!$(BPIMOS $B5Z$S(B KL1$B$K$D$$$F!$$h$j>\:Y$J@bL@$rI,MW$H$5$l$kJ}(B
$B$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$r;2>H$7$F2<$5$$!%$^$?!$(BKL1 $B$N%W%m%0(B
$B%i%_%s%05;K!$K$D$$$F$O!$(B\cite{KL1}$B!V(BKL1 $B%W%m%0%i%_%s%0(B $BF~Lg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$K$D$$$F@bL@$7$^$9(B.

\section{$B%f!<%6EPO?(B}

$B$^$:!$(BPSI $B$K%m%0%$%s$7$F$_$^$7$g$&!%(B $BI8=`%f!<%6$,$D$.$NL>A0$GMQ0U$5$l(B
$B$F$$$^$9(B. 

\begin{quote}
\begin{tabbing}
$B%^%k%A(BPSI$B%f!<%6$O!$(B\=$B%^%9%?(BFEP$B$K(B******   \= mpsi   \kill
Pseudo$B%^%k%A(BPSI$B%f!<%6$O!$(B \> \>       pmpsi \\
 \> \> \\
$B%^%k%A(BPSI$B%f!<%6$O!$(B\>$B%^%9%?(BFEP$B$K(B  \>  mpsi  \\
                      \>$B%9%l!<%V(BFEP$B$K(B \>   slave  \\
\end{tabbing}
\end{quote}
$B%Q%9%o!<%I$O%f!<%6L>$HF1$8$G$9(B. PIMOS$B$*$h$S(BCAL(KL1$B$N%/%m%9!&%7%9%F%`(B)
$B$N5/F0$O(B, $B%7%9%F%`%a%K%e%&$N$D$.$N$b$N$rA*Br$7$F9T$$$^$9(B.

\begin{itemize}
\item Pseudo Multi-PSI ~$B$"$k$$$O(B~ Multi-PSI\\
PIMOS $B$r5/F0$9$k:]$KA*Br$9$k9`L\!%(B
\item CAL\\
KL1$B$N%/%m%9%7%9%F%`(B.  $B%3%s%Q%$%k!&%"%;%s%V%k!&%j%s%/$,9T$($k(B.  CAL$B$r;HMQ$9$k$H(B,
$B%3%s%Q%$%k$7$?%W%m%0%i%`$O(B, PIMOS$BK\BN$N%*%V%8%'%/%H(B(pimos:pimos.kbn)$B$K%j%s%/$5(B
$B$l$k(B.  
\end{itemize}

$B$3$NI8=`%f!<%6$O!$%5%s%W%k$H$7$FMQ0U$5$l$?$b$N$J$N$G!$(BKL1$B%W%m%0%i%`(B 
$B$N3+H/<T$O<+J,MQ$N%f!<%6$rEPO?$7$F2<$5$$!%<j=g$O<!$NDL$j$G$9!%(B

\begin{enumerate}
\item $B%f!<%6EPO?(B ($B<B5!%^%k%A(BPSI$B$G$O%^%9%?(BFEP$B$N$_9T$J$&(B)\\ 
$B%f!<%6EPO?$O!$FC8"%f!<%6(B(superuser)$B$G%m%0%$%s$7$J$*$7(B,
              
$B%7%9%F%`%a%K%e!<(B $B$+$i<!$N=g$G9`L\$rA*Br$9$k$3$H$K$h$j9T$J$&$3$H$,$G$-(B
$B$^$9!%(B
\begin{quote}
others $\rightarrow$ user $\rightarrow$ maintenance $\rightarrow$
register
\end{quote}
$B%f!<%6$N%/%i%9$O(B, $B$D$.$N$h$&$K@_Dj$7$^$9!%(B
              
\begin{tabbing}
 Pseudo$B%^%k%A(BPSI$B%f!<%6$J$i$P!$(B
	**\=$B%i%s%/(B**\= general$B0J>e!$(B**\=$B=i4|%b!<%I(Bgeneral$B0J>e(B \kill\
 Pseudo$B%^%k%A(BPSI$B%f!<%6$J$i$P!$(B\>$B%i%s%/(B\> general$B!$(B\>$B=i4|%b!<%I(Bgeneral\\
 $B%^%k%A(BPSI$B%f!<%6$J$i$P!$(B     \> $B%i%s%/(B\> general$B!$(B\>$B=i4|%b!<%I(Bgeneral
\end{tabbing}
 $B$H$7$F2<$5$$!%EPO?$,=*$C$?$i%m%0%"%&%H$7$F!$:#EPO?$7$?%f!<%6L>$G%m%0(B
$B%$%s$7$F2<$5$$!%(B\\
$B%f!<%6EPO?!&4IM}$N>\:Y$J@bL@$O!$!V>.7?2=(BPSI/SIMPOS $B%7%9%F%`4IM}@bL@(B
$B=q!W(B\cite{SYSTEM}$B$r;2>H$7$F2<$5$$!%(B
\item $B4D6-@_Dj(B

$B3F%f!<%6MQ$N4D6-$r@_Dj$7$^$9!%(B\\
login.com $B$rI8=`%f!<%6$+$i%3%T!<$7$F!$<+J,$N4D6-$K9g$&$h$&$K=$@5$7$^$9!%(B
$B<!$NNc$r;29M$K$7$F2<$5$$(B(PMACS$B%(%G%#%?$GJT=8$7$^$9(B)$B!%(B

$BNc(B) $B%f!<%6L>$,(B Taro $B$5$s$N>l9g(B
\begin{enumerate}
\item $B%U%!%$%k%^%K%T%e%l!<%?$G!$I8=`%f!<%6$N(B {\tt login.com} $B$r(B Taro 
$B$5$s$N%G%#%l%/%H%j$K%3%T!<$7$^$9!%(B
\begin{verbatim}
   Pseudo $B$N$H$-(B
   >sys>user>pmpsi>login.com  $B$r(B >sys>user>Taro>*.*  $B$K%3%T!<$7$^$9!%(B
   $B%^%k%A(B PSI $B<B5!$N$H$-(B
   >sys>user>mpsi>login.com  $B$r(B >sys>user>Taro>*.*  $B$K%3%T!<$7$^$9!%(B
\end{verbatim}
\item PMACS $B%(%G%#%?$G(B
\begin{itemize}
\item $B%7%9%F%`%a%K%e!<$K0J2<FbMF$,EPO?$5$l$F$$$k$3$H$r3NG'$7$^$9!%(B
\begin{verbatim}
  menu :-
      items_list(
          .......................................
 %%%  Pseudo$B%^%k%A(BPSI                 Pseudo$B$N;~$N$_I,MW(B
       {"Pseudo Multi-PSI",  mpsicsp##pseudo_csp_main_program},

 %%%  $B%^%k%A(BPSI                       $B%^%k%A(B PSI $B<B5!$N;~$N$_I,MW(B
       {"Multi-PSI",         mpsicsp##csp_main_program},
               .......................................
 %%%  $B%/%m%9%7%9%F%`(BCAL 
       {"CAL",               cal##cal_manipulator},
\end{verbatim}
\item $BO@M}L>(B me $B$NDj5A$r<+J,$N%G%#%l%/%H%j$KJQ99$7$^$9!%(B
\begin{verbatim}
  define :- 
 %%%%         "me" := ["user:pmpsi"],   $B%3%a%s%H%"%&%H(B
              "me" := ["user:Taro"],
         .......................
\end{verbatim}
\item $B<!$NO@M}L>$,Dj5A$5$l$F$$$k$3$H$r3NG'$7$^$9!%(B
\begin{verbatim}

      Pseudo $B%^%k%A(BPSI$B$N>l9g(B
	
        "root"  := ["user:pmpsi"],
        "psys"  := [">sys>csp>SYSTEM.DIR"],
        "pmpsi" := [">sys>csp>PMPSI.DIR"],
        "pimos" := [">sys>csp>PIMOS.DIR"],


      $B%^%k%A(BPSI$B<B5!$N>l9g(B

        "root"  := [">sys>csp"],
        "mpsi"  := ["root:MPSI.DIR"],
        "msys"  := ["root:SYSTEM.DIR"],
        "pimos" := [">sys>csp>PIMOS.DIR"],

\end{verbatim}
\end{itemize}
\item $B$$$C$?$s%m%0%"%&%H$7$F!$%m%0%$%s$7$J$*$7$^$9!%(B
\item $B%7%9%F%`%a%K%e!<$K!$(B"Pseudo Multi-PSI" $B$"$k$$$O(B "Multi-PSI" $B$H(B 
"CAL" $B$N9`L\$,$"$k$3$H$r3NG'$7$^$9!%(B
\item $B%^%k%A(BPSI$B<B5!$N>l9g$O%^%9%?(BFEP$B$N!$(B
\begin{quote}
msys:MPSI.CONFIG
\end{quote}
$B$rJT=8$7!$3F(BFEP$B$N%M%C%H%o!<%/%"%I%l%9$r@_Dj$7$F2<$5$$!%@_DjJ}K!$O!$(BCSP$B%^(B
$B%K%e%"%k(B\cite{CSP}$B$N(B6.3.5$B$N(B(3)feps$B$r;2>H$7$F2<$5$$!%(B
msys:MPSI.CONFIG$B$K$O(B, $B%$%s%9%H!<%k;~$K%^%7%s9=@.$K$"$o$;$?FbMF$,5-=R$7$F$"$k$N(B
$B$G(B, $B%M%C%H%o!<%/%"%I%l%9$N$_JQ99$7$F$/$@$5$$(B.				

\end{enumerate}
\end{enumerate}
\vspace{1 cm}
\section{$B%+%9%?%^%$%:(B}
\label{sec:custom}
\begin{itemize}
\item $B<+J,MQ$N%7%9%F%`%G%#%l%/%H%j$H$7$F!$<!$N%G%#%l%/%H%j$r:n$j$^$9!%(B
\begin{verbatim}
                  me:PIMOS.DIR
                  me:SYSTEM.DIR   ( Pseudo $B%^%k%A(B PSI $B$N;~$N$_!%(B)

\end{verbatim}

\item Pseudo$B%^%k%A(BPSI$B$N>l9g$O(B, 
$B<+J,$N(Bme:SYSTEM.DIR$B$K!$(Bpsys:$B$NA4%U%!%$%k$r%3%T!<$7$^$9(B
$B%3%T!<$5$l$k%U%!%$%k$O$D$.$N(B4$B8D$G$9!%(B
\begin{verbatim}
                  MPSI.CONFIG
                  MPSI.PARAM
                  boot.init
                  usercom.init
\end{verbatim}

\item $B<+J,$N(Bme:PIMOS.DIR$B$K(B pimos: $B$K$"$k(B pimos.mac $B0J30$N(B5$B$D$N%U%!%$%k$r%3(B
$B%T!<$7$^$9!%(B
\begin{verbatim}
                  pimos.conf
                  pimos.kbn
                  pimos.ldb
                  pimos.sym
                  pimos.users
\end{verbatim}
\item $B:#%3%T!<$7$?(B pimos.users $B$N0J2<$N2U=j$r=$@5$7$^$9!%(B
\begin{verbatim}
            %%% [system(*,*,"sys>user>ShellUser",*,
                [system(*,*,"sys>user>Taro",*,

            %%% [system(*,*,"sys>user>ListenerUser",*,
                [system(*,*,"sys>user>Taro",*,
\end{verbatim}
$B$3$N%U%!%$%k(B($BMxMQ4D6-@_Dj%U%!%$%k(B)$B$O!$(BPIMOS $B$X$N%m%0%$%s;~$K<B9T$9$k%?(B
$B%9%/$r;XDj$9$k$?$a$N$b$N$G$9!%(B

$B$"$J$?$O!$%U%!%$%k$K<+J,$N%m%0%$%sL>$H%m%0%$%s;~$K<B9T$9$k$N%?%9%/(B($B$"(B
$B$J$?$N%W%m%0%i%`$N<B9T$r4^$`(B)$B$r;XDj$9$k$3$H$,$G$-$^$9!%(B

$BMxMQ4D6-@_Dj%U%!%$%k$N>\:Y$O(BPIMOS$B%^%K%e%"%k(B\cite{PIMOS}12.3$B$r;2>H$7$F(B
$B$/$@$5$$!%(B

\item login.com $B$r<!$N$h$&$K=$@5$7$^$9!%(B
\begin{verbatim}

            %%%  "psys"  := [">sys>csp>SYSTEM.DIR"],
              "psys"  := ["me:SYSTEM.DIR"],      (Pseudo$B%^%k%A(BPSI$B$N$_(B)
            %%%  "pimos" := ["sys>csp>PIMOS.DIR"],
              "pimos" := ["me:PIMOS.DIR"],

\end{verbatim}

\item Pseudo$B%^%k%A(BPSI$B$G$O!$%3%s%U%#%.%e%l!<%7%g%s!&%U%!%$%k(B
\begin{verbatim}
                  psys:MPSI.CONFIG
\end{verbatim}
$B$rJQ99$9$k$3$H$K$h$C$F!$;HMQ$9$k%W%m%;%C%5?t$J$I$N%7%9%F%`$N9=@.$rJQ99(B
$B$G$-$^$9!%(B
($B%U%!%$%k$NJQ99$NJ}K!$K$D$$$F$O!$(BCSP$BA`:n@bL@=q(B\cite{CSP}$B$N(B4$B>O!$(B6$B>O$r;2(B
$B>H$7$F2<$5$$!%<B5!%^%k%A(BPSI$B$N>l9g$OJQ99$G$-$^$;$s!%(B)\\
$B0J>e$G!$(BSIMPOS$B>e$G$N=`Hw$O$G$-$^$7$?!%(B
\item $B$b$&0lEY!$%m%0%$%s$7$J$*$7$F(BPIMOS$B$r5/F0$7$^$7$g$&!%(B
\end{itemize}

\chapter{PIMOS$B$N5/F0!$%m%0%$%s!$%7%c%C%H%@%&%s(B}
\label{chap:boot}
$B$3$N>O$G$O(B PIMOS $B$N5/F0!$%m%0%$%s!$%7%c%C%H%@%&%s$NJ}K!$K$D$$$F@bL@$7(B
$B$^$9!%$^$?(B PIMOS $B$,@5>o$K5/F0$7$J$+$C$?>l9g$NBP=hJ}K!$K$D$$$F$b4JC1$K(B
$B<($7$^$9!%(B

\section{(Pseudo)$B%^%k%A(BPSI$B$N5/F0(B}
\subsection{Pseudo$B%^%k%A(BPSI$B$N>l9g(B}
  SIMPOS $B$K%m%0%$%s$7$?D>8e!$$"$k$$$O!$%m%0%$%s8e$K%^%&%9$N1&%\%?%s$r(B
$B#22s%/%j%C%/$9$k$H%7%9%F%`%a%K%e!<$,8=$l$^$9!%(BPseudo $B%^%k%A(B PSI $B$O$3$N(B
$B%a%K%e!<$N(B "Pseudo Multi-PSI"$B$H$$$&9`L\$rA*Br$7$F5/F0$7$^$9!%(B


\setlength{\unitlength}{1.1mm}
\begin{picture}(120,65)(-60,-30)
\small
\put(-60,22){\framebox(120,7)[l]{~~SYSTEM MENU}}
\put(-60,-22){\framebox(120,44){}}
\put(-17.5,14){\framebox(35,6){Pseudo Multi-PSI}}
\put(0,7.5){\makebox(0,0){CAL}}
\put(0,.5){\makebox(0,0){(Pseudo)Multi-PSI Installer}}
\end{picture}

$B%^%k%A(BPSI-CSP$B$,5/F0$5$l$k$H!$:8$K!X>uBV4F;k%Q%M%k!Y!$1&$K!X(BCSP$B%3%^%s(B
$B%I%&%$%s%I%&!Y$,8=$l$^$9!%(B
( SIMPOS $B$rN)$A>e$2$?8e!$(BPIMOS $B$r:G=i$K5/F0$9$k:]$K$O!$(BCSP$B%W%m%0%i%`$N(B
$B%m!<%G%#%s%0$N$?$a!$B?>/;~4V$,$+$+$j$^$9!%(B)

  CSP$B%3%^%s%I%&%$%s%I%&$K$O!$<!$N$h$&$J%a%C%;!<%8$,=PNO$5$l$?$N$A!$(B
$B%W%m%s%W%H(B \$ $B$,I=<($5$l$^$9(B.
\begin{verbatim}
    Initiating all Pes from configulation file MPSI.CONFIG
    Current PEs are
        0, 1, 2, 3, 4, 5, 6, 7
    Current Default PEs are
        0, 1, 2, 3, 4, 5, 6, 7
    PE auto power on... All PEs power ready.
    PEs initiation completed

    $
\end{verbatim}

\subsection{$B%^%k%A(BPSI$B$N>l9g(B}
 $B$3$3$G$OI8=`E*$J%f!<%6(B($BA4$F$N(BFEP$B$,(BPSI$B%M%C%H$G$D$J$,$C$F$$$k(B)$B$N>l9g$K(B
$B$D$$$F@bL@$7$^$9!%(B
$B$=$l0J30$N>l9g$*$h$S!$>\:Y$O(BCSP$B%^%K%e%"%k(B\cite{CSP}$B$N(B4$B>O!$(B $B$*$h$S(B6$B>O$r(B
$B;2>H$7$F2<$5$$!%(B
\begin{enumerate}
\item  $B%^%9%?(BFEP$B$*$h$S(B,$B%9%l!<%V(BFEP$B$NEE8;$rF~$l!$$=$l$i$r$9$Y$FN)$A>e$2(B
$B$^$9!%(B
\item $B%9%l!<%V(BFEP$B$K%f!<%6L>(B
\begin{quote}
{\tt slave ( $B%Q%9%o!<%I$bF1$8(B )}
\end{quote}
$B$G%m%0%$%s$7$^$9!%(B
\item $B%^%9%?(BFEP$B$+$i$NDL?.BT$A$H$$$&%a%C%;!<%8$,I=<($5$l$k$N$r3NG'$7$^(B
$B$9!%(B
\begin{verbatim}
    $B$?$@$$$^%^%9%?(BCSP$B$+$i$NDL?.BT5!Cf$G$9(B.  $B$7$P$i$/$*BT$A2<$5$$(B.  
    Now Waiting Orders from Master CSP.  Please wait ...
\end{verbatim}
\item $B%^%9%?(BFEP$B$K<+J,$NEPO?$7$?%f!<%6L>$G%m%0%$%s$7$^$9!%(B
\item $B%7%9%F%`%a%K%e!<$+$i%^%k%A(BPSI$B$KBP1~$9$k9`L\$rA*Br$7$^$9!%(B

\setlength{\unitlength}{1.1mm}
\begin{picture}(120,65)(-60,-30)
\small
\put(-60,22){\framebox(120,7)[l]{~~SYSTEM MENU}}
\put(-60,-22){\framebox(120,44){}}
\put(-17.5,14){\framebox(35,6){Multi-PSI}}
\put(0,7.5){\makebox(0,0){CAL}}
\put(0,.5){\makebox(0,0){(Pseudo)Multi-PSI Installer}}
\end{picture}

\item $B%^%9%?!$%9%l!<%VN>(B FEP $B>e$G(B CSP $B$,5/F0$5$l$^$9(B.
\item $B%9%l!<%V(BFEP$B$K$O(B sys:MPSI.CONFIG $B$H$$$&%U%!%$%k$,B8:_$7$J$$$H$$$&(B
$B%a%C%;!<%8$,I=<($5$l$^$9$,!$L5;k$7$F$/$@$5$$!%(B
\begin{verbatim}
    Configuration File does't exist.  sys:MPSI.CONFIG
    Slave FEP-CSP Program is Starting !!!
\end{verbatim}
\item $B%^%9%?(B FEP $B$K$O!$:8$K!X>uBV4F;k%Q%M%k!Y!$1&$K!X(BCSP$B%3%^%s%I%&%$%s(B
$B%I%&!Y$,8=$l$^$9!%(B( SIMPOS $B$rN)$A>e$2$?8e!$(BPIMOS $B$r:G=i$K5/F0$9$k:](B
$B$K$O!$(BCSP$B%W%m%0%i%`$N%m!<%G%#%s%0$N$?$a!$B?>/;~4V$,$+$+$j$^$9!%(B)
\item CSP$B%3%^%s%I%&%$%s%I%&$K$O!$<!$N$h$&$J%a%C%;!<%8$,=PNO$5$l$^$9!%(B
\begin{verbatim}			
    Initiating all Pes from configulation file MPSI.CONFIG
    Current PEs are
        0, 1, 2, 3, 4, 5, 6, 7
    Current Default PEs are
        0, 1, 2, 3, 4, 5, 6, 7
    PE auto power on... All PEs power ready.  Memory Configuration...
    PEs initiation completed

    $
\end{verbatim}
\end{enumerate}
\$ $B$O(B CSP $B$N%W%m%s%W%H$G$9!%<!@a$G<($9%*!<%H%V!<%H$r@_Dj$9$k$H!$%W%m(B
$B%s%W%H$OI=<($5$l$:!$D>$A$K(B PIMOS $B$r5/F0$7$^$9(B.  
$B$3$N%W%m%s%W%H$KBP$7!$(B? $B$^$?$O(B help $B$rF~NO$9$k$H!$A4$F$N(B CSP$B%3%^%s%I$,(B
$BI=<($5$l$^$9(B.  $B3F%3%^%s%I$N5!G=$K$D$$$F$O!V(BCSP $BA`:n%^%K%e%"%k!W(B
\cite{CSP}$B$r;2>H$7$F2<$5$$!%(B

\section{$B%*!<%H%V!<%H$N@_Dj(B}

PIMOS $B$NN)$A>e$2$O!$%*!<%H%V!<%H%9%$%C%A$r@_Dj$7$F$*$/$3$H$K$h$j(B, 
$B%7%9%F%`%a%K%e!<$+$i(B``(Pseudo) Multi-PSI''$B$rA*Br$7$F<+F0E*$K9T$&(B
$B$3$H$,$G$-$^$9(B.  $B@_Dj$NJ}K!$O<!$NDL$j$G$9!%(B

CSP$B%3%^%s%I%&%$%s%I%&$G!$%W%m%s%W%H$KB3$$$F%3%^%s%I(B
\begin{quote}
       \$ ~~\underline{\tt panel}
\end{quote}
$B$rF~NO$7$^$9!%(B

 $B$9$k$H!$!X(BCSP Console Panel$B!Y$,I=<($5$l$^$9!%(B $B!X(BCSP Console Panel$B!Y$O!$(B
$B$$$/$D$+$N%5%V%a%K%e!<$+$i@.$C$F$$$^$9!$$3$l$i$N%5%V%a%K%e!<$r<!$N$h$&(B
$B$K@_Dj$7$^$9!%(B
\begin{enumerate}
\item $B%*!<%H%V!<%H$N%9%$%C%A72$r0J2<$N$h$&$K@_Dj$7$^$9!%(B
\begin{tabbing}
        CLEAR \=********** \=ON***  \=OFF \kill
        CLEAR \> \> \fbox{ON}  \> OFF \\
        INIT  \> \> \fbox{ON}  \> OFF \\
        IMPL  \> \> \fbox{ON}  \> OFF \\
        Patch \> \> \fbox{ON}  \> OFF \\
        - - - - - - - - - - - - - - - - - -\\
        IPL \>   \>  \fbox{ON} \> OFF \\
        START \\
        \> \fbox{PIMOS} \> ON \> OFF
\end{tabbing}

\item 	PIMOS $B$NN)$A>e$2$KI,MW$J%U%!%$%k$OI8=`$H$7$F<!$N$h$&$K@_Dj$5$l(B
$B$F$$$^$9!%I,MW$K1~$8$FJQ99$7$F2<$5$$!%(B

\begin{itemize}
\item Pseudo$B%^%k%A(BPSI$B$N>l9g(B

\begin{tabbing}

        SYMBOL \= FILE (.sym)   \= kl1:mypimos \kill
        CLEAR \> FILE (.mbn)   \> \fbox{(Don't care on Pseudo)} \\
        INIT  \> FILE (.mbn)   \> \fbox{(Don't care on Pseudo)} \\
        INIT  \> FILE (.mbn)   \> \fbox{(Don't care on Pseudo)} \\
        IMPL  \> FILE (.mbn)   \> \fbox{(Don't care on Pseudo)} \\
        IMPL  \> FILE (.kbn)   \> \fbox{pmpsi:kl1kp.kbn} \\ 
        PATCH \> FILE (.com)   \> \fbox{pmpsi:kl1pat.com} \\
        IPL   \> FILE (.kbn)     \> \fbox{pimos:pimos.kbn} \\
        SYMBOL \> FILE (.sym)  \>  \fbox{pimos:pimos.sym} \\
        START \> ADDRESS  \>  \fbox{202}
\end{tabbing}

\item $B%^%k%A(BPSI$B$N>l9g(B


\begin{tabbing}
        SYMBOL \= FILE (.sym)   \= kl1:mypimos \kill
        CLEAR \> FILE (.mbn)   \> \fbox{mpsi:MCLEAR.MBN} \\
        INIT  \> FILE (.mbn)   \> \fbox{mpsi:MINIT.MBN} \\
        INIT  \> FILE (.mbn)   \> \fbox{mpsi:MIDAT.MBN} \\
        IMPL  \> FILE (.mbn)   \> \fbox{mpsi:MPSI.MBN} \\
        IMPL  \> FILE (.kbn)   \> \fbox{(Don't care on MPSI)}\\ 
        PATCH \> FILE (.com)   \> \fbox{mpsi:MPSIPAT.com} \\
        IPL   \> FILE (.kbn)   \> \fbox{pimos:pimos.kbn} \\
        SYMBOL \> FILE (.sym)  \>  \fbox{pimos:pimos.sym} \\
        START \> ADDRESS  \>  \fbox{2000}
\end{tabbing}
\end{itemize}

\item $B%^%&%9$G<!$N9`L\$N(B "AUTO" $B$rA*Br$7$^$9!%(B
\begin{quote}
        Power On Auto Boot  ~~~~ \fbox{AUTO}   CONSOLE
\end{quote}      
\item $B:G8e$K!$>e5-@_Dj$r%;!<%V$7$^$9!%(B
\begin{quote}
       \fbox{SAVE}    EXIT
\end{quote}
\item Console Panel$B$rJD$8$F!$=*N;$7$^$9!%(B
\begin{quote}
       SAVE   \fbox{EXIT}
\end{quote}
\end{enumerate}

\section{CSP $B$+$i$N(B PIMOS $B$NN)$A>e$2(B}
$B%*!<%H%V!<%H$,@_Dj$5$l$F$$$J$$>l9g$O!$(BCSP $B$+$i%3%^%s%I$G(B PIMOS $B$rN)$A>e$2$^$9!%(B
CSP $B%3%^%s%I%&%$%s%I%&$+$i(B {\tt boot} $B$HF~NO$7$^$9!%(B
\begin{quote}
     \$~~\underline{\tt boot}
\end{quote}
$B$3$l$K$h$C$F%V!<%H$,;O$^$j!$<B5!%^%k%A(BPSI$B$G$O<+F0E*$K3F%W%m%;%5$KEE8;(B
$B$,F~$j$^$9!%(B

\section{$B%m%0%$%s(B}
PIMOS$B$,@5>o$K5/F0$5$l$k$H(B PIMOS $B$K%m%0%$%s$9$k$?$a$NMxMQ4D6-@_Dj%&%#%s(B
$B%I%&$,3+$-$^$9!%(B

\begin{center}
\begin{picture}(50,50)(-25,-20)
\footnotesize
\put(-17,20){\framebox(45,7)[l]{~USERS}}
\put(-17,-20){\framebox(45,40){}}
\put(-17,13){\makebox(50,7)[l]{\tt User Name>>}}
\end{picture}
\end{center}

$B$3$3$G!$MxMQ4D6-@_Dj%U%!%$%k(B{\tt "pimos:pimos.users"} $B$KEPO?$5$l$F$$$k(B
$B%f!<%6L>$rF~NO$7$^$9!%<!$N;0$D$N%f!<%6L>$,I8=`$H$7$FMQ0U$5$l$F$$$^$9!%(B
\begin{quote}
{\tt ShellUser, ListenerUser, shutdown}
\end{quote}
$BMxMQ4D6-@_Dj%U%!%$%k$N>\:Y$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B12.3$B$r;2(B
$B>H$7$F$/$@$5$$!%(B

\begin{quote}
 {\tt User Name>>}\underline{\tt ShellUser}
\end{quote}
$B$HF~NO$9$k$H!$%7%'%k(B($B8e=R(B)$B$,5/F0$5$l$^$9!%(B
\begin{quote}
{\tt User Name>>}\underline{\tt ListenerUser}
\end{quote}
$B$HF~NO$9$k$H!$%j%9%J(B($B8e=R(B)$B$,5/F0$5$l$^$9!%(B

KL1 $B%W%m%0%i%`$N%3%s%Q%$%k!$<B9T!$%G%P%C%0$O%7%'%k$*$h$S%j%9%J$N>e$G(B
$B9T$J$&$3$H$,$G$-$^$9!%(B
					
PIMOS $B$K$O%m%0%"%&%H$,$"$j$^$;$s(B.  $B$^$?(B, $BJ#?t2s%m%0%$%s$9$k$3$H$,$G$-(B
$B$^$9!%$?$H$($P!$(B{\tt ShellUser} $B$GFs2s%m%0%$%s$9$k$H(B, $B%7%'%k$,(B2$B$D5/F0(B
$B$5$l$^$9!%(B

\section{$B%7%c%C%H%@%&%s(B}
PIMOS$B$r=*N;$9$k$K$O!$MxMQ4D6-@_Dj%&%$%s%I%&$G!$<!$N$h$&$KF~NO$7$^$9!%(B
\begin{quote}
{\tt User Name>>} \underline{\tt shutdown}
\end{quote}
$B%7%c%C%H%@%&%s$r9T$&$+$I$&$+$r3NG'$9$k%&%$%s%I%&$,I=$l$k$N$G!$(B
\begin{quote}
Really(yes/no)? \underline{\tt yes}
\end{quote}
$B$rF~NO$7$F2<$5$$!%$9$k$H!$(BCSP$B%&%$%s%I%&$K<!$N$h$&$J%a%C%;!<%8$,I=<($5(B
$B$l$^$9!%(B
\begin{quote}
 Do you want to exit from CSP ? [Y/N] : \underline{\tt y} 
\end{quote}
$B$3$3$G!$(By $B$rF~NO$7$F2<$5$$!%(B

$B$3$l$G(B(Pseudo)$B%^%k%A(BPSI$B$,=*N;$7$^$9<B5!$G$O3F%W%m%;%5$NEE8;$,<+F0E*(B
$B$K@Z$l$^$9(B).  

PIMOS$B$N=*N;$K$D$$$F$N>\:Y$O(B PIMOS$B%^%K%e%"%k(B\cite{PIMOS}$B$N(B12$B>O(B
$B$r;2>H$7$F2<$5$$!%$^$?!$%^%k%A(BPSI$B$NEE8;!$(BCSP$B$K$D$$$F$O(BCSP$B%^%K%e%"%k(B
\cite{CSP}$B$N(B7$B>O$r;2>H$7$F2<$5$$!%(B

\section{PIMOS$B$NCfCG(B}
$B2?$+$NM}M3$G(B PIMOS $B$N<B9T$rCfCG$7$?$$>l9g$O!$<!$NJ}K!$G(B CSP $B$N%W%m%s%W(B
$B%H$K@)8f$rLa$9$3$H$,$G$-$^$9!%(B

\begin{enumerate}
\item CSP$B%3%^%s%I%&%$%s%I%&>e$G%^%&%9(B($B:8%\%?%s(B)$B$r%/%j%C%/$7$F!$%&%$%s(B
$B%I%&$rA*Br$7$?8e!$(B
\begin{quote}
Control-C
\end{quote}
$B$rF~NO$7$F2<$5$$!%(B

\item Control-C $B$,Mx$+$J$$>l9g$O!$:8>e$N!X>uBV4F;k%Q%M%k!Y$G%^%&%9$N:8(B
$B%\%?%s$r%/%j%C%/$7$?$"$H!$(Babort $B%-!<$r2!$7$^$9!%%&%$%s%I%&$,$"$i$o$l$?$i(B
\begin{quote}
"Return to Csp Toplevel" 
\end{quote}
$B$rA*Br$7$F2<$5$$!%(B
\end{enumerate}

$BCfCG$7$?8e!$(BPIMOS $B$N<B9T$r:F3+$9$k$K$O!$(BCSP$B%3%^%s%I%&%$%s%I%&$+$i!$(B
\begin{quote}
{\tt \$}\underline{\tt go}
\end{quote}
$B$HF~NO$7$F2<$5$$!%(B

\section{PIMOS$B$N5/F0$K<:GT$7$?;~(B}
Pseudo $B%^%k%A(BPSI$B$G$O(BCAL$B$rMQ$$$F%j%s%/$7$?(BPIMOS$BK\BN$N%*%V%8%'%/%H(B
\begin{verbatim}
        pimos:pimos.kbn
        pimos:pimos.ldb
        pimos:pimos.sys
\end{verbatim}
$B$K2?$i$+$NLdBj$,$"$k$H!$5/F0$K<:GT$9$k$3$H$,$"$j$^$9!%(B

\begin{itemize}
\item CSP Console $B%&%$%s%I%&$K(B " Copying GC Memory Shortage " $B$N$h$&(B
$B$J%a%C%;!<%8$,=P$?>l9g!%(B\\
$BBh(B \ref{chap:setup} $B>O$N:G8e$N@a$K<($7$?%3%s%U%#%.%e%l!<%7%g%s%U%!(B
$B%$%k$rJQ99$7$F%W%m%;%C%5$NBf?t$r8:$i$7$F2<$5$$!%(B
PIMOS $B$r0lC6%7%c%C%H%@%&%s$7$F%7%9%F%`%a%K%e!<$+$i:F5/F0$9$k$H!$@5>o$K(B
$B5/F0$G$-$k>l9g$,$"$j$^$9!%(B

\item $B%f!<%6$N%W%m%0%i%`$K%P%0$,$"$k>l9g(B\\
$B>e5-;0$D$N%U%!%$%k$r0lEY>C$7$F(B, {\tt "sys>csp>PIMOS.DIR"}$B$+$i%3%T!<$7D>$7(B, 
PIMOS$BK\BN$N%*%V%8%'%/%H$r:n$jD>$7$F2<$5$$!%(B

\item PIMOS$BK\BN$,%Q%C%A$N$?$a$KBg$-$/$J$j$9$.$?>l9g(B\\
CAL $B$K$h$C$F2?2s$b%W%m%0%i%`$r(BPIMOS$B$K%j%s%/$9$k$H!$(BPIMOS $BK\BN$N%Q%C%A(B
$B$,Bg$-$/$J$j!$5/F0$K<:GT$9$k$3$H$,$"$j$^$9!%$3$N>l9g$b!$>e$HF1MM$K$7$F(B
$BK\BN$r%3%T!<$7$J$*$7!$(BCAL $B$K$h$k%3%s%Q%$%k!&%j%s%/$H(B PIMOS $B$N5/F0$r:G(B
$B=i$+$i$d$j$J$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$l$?3F%4!<%k$N(B
$B<B9T$O!$JL!9$N%W%m%;%C%5$K3d$jEv$F$k$3$H$K$h$C$F!$JBNs$K<B9T$9$k$3$H$,(B
$B$G$-$^$9!%%\%G%#It$N%4!<%k$r%W%m%;%C%5$K3d$jIU$1$kJ}K!$K$D$$$F$O<!>O$G(B
$B@bL@$7$^$9!%(B

\subsection{$B%4!<%k$N<:GT(B}
KL1 $B$N%3%_%C%H%*%Z%l!<%?(B {\tt "|"}$B$O(B Prolog $B$N%+%C%H%*%Z%l!<%?(B{\tt
"!"}$B$H;w$?F/$-$r$7$^$9!%%3%_%C%H%*%Z%l!<%?$NA0$K$"$k%,!<%IIt$G$O!$%4!<(B
$B%k$,<:GT$7$F$b!$<B9T$OB>$N@a$K0\$j$^$9$,!$%3%_%C%H%*%Z%l!<%?$N8e$m$K$"(B
$B$k%\%G%#It$G$O!$%4!<%k$,<:GT$9$k$H!$$=$N?F$N%4!<%k$,<:GT$7%W%m%0%i%`A4BN$N(B
$B<B9T$,<:GT$7$F=*$j$^$9!%(B

\subsection{$B%G!<%?7?(B}
KL1 $B$GMQ$$$k$3$H$,2DG=$J%G!<%?7?$K$O0J2<$N$b$N$,$"$j$^$9!%(B
\begin{itemize}
\item $BJQ?t(B ( {\tt Var,\_,} etc. )
\item $B@0?t(B ( {\tt 138, 16'8A,} etc. ) 
\item $BIbF0>/?tE@?t(B ( {\tt 1.23, 1.0E10,} etc. )
\item $B%"%H%`(B ( {\tt a, 'ABC',} etc. )
\item $B%j%9%H(B ({\tt [1,2,3], [a,[A,b],c|Y]}, etc. )
\item $B%Y%/%?(B ( {\tt \{a,b,c\}, \{\}, a(b),} etc. )
\item $B%9%H%j%s%0(B ( {\tt "abc", "",} etc. )
\item $B%b%8%e!<%k(B ( {\tt module\#foo,} etc. )
\end{itemize}
$B%G!<%?7?$N>\:Y$K$D$$$F$O!V(BPIMOS$B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B2.1.3$B$r;2>H$7(B
$B$F2<$5$$!%(B

\subsection{$BAH$_9~$_=R8l(B}
KL1 $B$GMQ0U$5$l$?AH$_9~$_=R8l$K$O!$%,!<%IIt$GMQ$$$k$3$H$,$G$-$k$b$N!$%\(B
$B%G%#It$GMQ$$$k$3$H$,$G$-$k$b$N!$$=$NN>J}$GMQ$$$k$3$H$,$G$-$k$b$N$N#3<o(B
$BN`$,$"$j$^$9!%(B

$BAH$_9~$_=R8l$N>\:Y$K$D$$$F$O!V(BPIMOS$B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B2.2$B$r;2>H(B
$B$7$F2<$5$$!%(B

\section{KL1 $B%W%m%0%i%`$NNc(B}
KL1 $B%W%m%0%i%`$K$D$$$F!$<B:]$NNc$r8+$k$3$H$K$7$^$7$g$&!%(B
$B$$$^<!$N$h$&$J(Bsample1.kl1$B$H$$$&%U%!%$%k$r:n@.$7$?$H$7$^$9(B( KL1 $B%W%m%0%i(B
$B%`$N%U%!%$%kL>$K$OI,$:(B ".kl1" $B$H$$$&B0@-$rIU$1$F2<$5$$(B)$B!%(B
\begin{verbatim}

        :- module sample1.                       %(1-1)
        :- public furui/3.                       %(1-2)

        furui([],Even,Odd):- true |              %(1-3)
                Even=[],
                Odd=[].
        furui([N|List],Even,Odd):-               %(1-4)
                N mod 2 =:= 0 |
                Even=[N|Tail],
                furui(List,Tail,Odd).
        furui([N|List],Even,Odd):-               %(1-5)
                N mod 2 =\= 0 |
                Odd=[N|Tail],
                furui(List,Even,Tail).           %(1-6)

\end{verbatim}

$B$3$3$G!$(B
\begin{quote}
{\tt `=:='} $B$O1&JU$H:8JU$N@0?t1i;;7k2L$NF1CM@-$NHf3S$r<($7$^$9!%$3$l$i(B
$B$N5-K!$N>\:Y$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$r;2>H$7$F2<$5$$!%(B
\end{quote}

(1-1)$B$O%W%m%0%i%`$N%b%8%e!<%kL>$,(B 'sample1' $B$G$"$k$3$H$r<($9@k8@$G$9!%(B
$B$^$?!$(B

(1-2)$B$O%b%8%e!<%k$N30It$+$i;2>H2DG=$J=R8lL>$H$=$N0z?t$N?t$r<($9@k8@$G(B
$B$9!%(B

KL1 $B$G$O3F%W%m%0%i%`%U%!%$%k$N@hF,$K(B (1-1),(1-2)$B$N$h$&$J!$%b%8%e!<%kL>(B
$B$H30It;2>H2DG=$J=R8lL>$N@k8@$,I,MW$G$9!%(B

$BB>$N%b%8%e!<%k$N%4!<%k$r8F$S=P$9;~!$$"$k$$$O!$%f!<%6$,%j%9%J(B($BBh(B 
\ref{chap:Listener} $B>O;2>H(B)$B$+$i%4!<%k$r8F$V;~$K$O!$(B
\begin{quote}
 "$B%b%8%e!<%kL>(B:$B%4!<%kL>(B"
\end{quote}
$B$H$$$&7A$G8F$S$^$9!%:#%4!<%k(B furui $B$r!$%j%9%J$+$i(B
\begin{verbatim}
        ?- sample1:furui([2,5,6,8,0,9],Even,Odd).
\end{verbatim}
$B$H8F$V$H!$$=$l$,(B (1-4) $B$"$k$$$O(B (1-5) $B$H%^%C%A$7$^$9$,!$%,!<%IIt$N<B9T(B
$B$O(B (1-4) $B$N@a$KBP$9$k$b$N$@$1$,@.8y$7$^$9!%$3$l$K$h$C$F!$(B(1-4) $B$N%\%G%#(B
$BIt$,5/F0$5$l!$=PNOJQ?t$X$N%f%K%U%#%1!<%7%g%s(B
\begin{quote}
{\tt Even = [2|Tail]}
\end{quote}
$B$H!$%4!<%k(B
\begin{quote}
{\tt furui([5,6,8,0,9],Odd,Tail)}
\end{quote}
$B$N:F5"E*$J8F$S=P$7$,<B9T$5$l$^$9!%(B
\begin{description}
\small
\item $BCm0U(B : $B>e$N%W%m%0%i%`$NNc$N$h$&$K!$(BKL1 $B$G$OI,$:!$(B( {\tt
Even=[N|Tail]} $B$N$h$&$J(B )$B=PNOJQ?t$X$NCM$NB+G{$O%\%G%#It$G5-=R$7$^(B
$B$9!%$3$l$O!$<!@a$G=R$Y$k$h$&$J%W%m%;%9F14|$N5!9=$+$i$/$k@)Ls$G$9!%(B
\end{description}

$B:F5"E*$K8F$P$l$?%4!<%k(B {\tt furui([5,6,8,0,9],Odd,Tail)} $B$KBP$7$F$O(B 
(1-5) $B$N%,!<%IIt$,@.8y$7!$$=$N%\%G%#It$G!$(B
\begin{quote}
{\tt Odd = [5|Tail]}\\
$B5Z$S(B\\
{\tt furui([6,8,0,9],Tail,Even)}
\end{quote}
$B$,<B9T$5$l$^$9!%(B

$B7k6I$3$N%W%m%0%i%`$N<B9T$K$h$C$F!$(B
\begin{quote}
{\tt Odd = [5,9], Even = [2,6,8,0]}
\end{quote}
$B$H$$$&7k2L$,F@$i$l$^$9!%(B
\vspace{3mm}

$B>e$NNc$G!$@a(B(1-5)$B$NBe$o$j$K<!$N@a$rCV$/$3$H$,$G$-$^$9!%(B
\begin{verbatim}
        otherwise.
        furui([N|List],Odd,Even):-              %(1-5')
                true |
                Odd=[N|Tail],
                furui(List,Tail,Even).
\end{verbatim}
$B$3$3$K$"$k(B otherwise. $B$OH]Dj$r5-=R$9$k$?$a$NN,5-K!$G$9!%(BOR$B$N4X78$K$"$k(B
$B@a$N4V$K(B otherwise. $B$rA^F~$9$k$H!$(BKL1 $B$N=hM}7O$O$=$N>e$N@a$NA*Br$,A4$F(B
$B<:GT$7$?>l9g$N$_!$$=$N2<$N@a$rA*Br$7$^$9!%$h$C$F!$(Botherwise. $B0J2<$N@a(B
$B$N%,!<%IIt$G$O(B, $B$=$N>e$N@a$N%,!<%IIt$N>r7o$,A4$F@.$jN)$?$J$$$3$H$r3NG'(B
$B:Q$_$G$"$k$H$7$F!$$=$NB>$N>r7o$N$_$r5-=R$9$l$P$h$$$3$H$K$J$j$^$9!%(B
\vspace{3mm}

otherwise. $B$rMQ$$$?(BKL1$B$N%W%m%0%i%`$NNc$r$b$&0l$D<($7$^$9!%(B

\begin{verbatim}
        :- module sample2.
        :- public check/2.

        check([], Out):- true | Out = []           
        check([M|In], Out):- atom(M) |
                Out = [atom|Out1], check(In, Out1).
        check([M|In], Out):- integer(M) |
                Out = [integer|Out1], check(In, Out1).
        check([M|In], Out):- string(M,_,_) |
                Out = [string|Out1], check(In, Out1).
        check([M|In], Out):- list(M) |
                Out = [list|Out1], check(In, Out1).
        check([M|In], Out):- vector(M,_) |
                Out = [vector|Out1], check(In, Out1).
        otherwise.
        check([_|In], Out):- true |                      %(2-1)
                check(In, Out).

\end{verbatim}
$B@a(B (2-1) $B$O$3$N=R8l$,<:GT$7$J$$$?$a$KI,MW$J=hM}$NDj5A$G$9!%$3$l$K$h$C(B
$B$F!$Nc30E*$J%G!<%?$OL5;k$5$l$^$9!%(B

$B<B9TNc(B

$B$3$N%W%m%0%i%`$r<B9T$9$k$H$D$.$N$h$&$K$J$j$^$9(B.  
\begin{verbatim}
        ?- sample2:check([1,a,"ds",23.5,{a,b}],X).

        X = [integer, atom, string, vector]

        yes.
        ?-
\end{verbatim}
$B$3$N$h$&$K!$(Botherwise. $B0J2<$N=hM}$K$h$C$FF~NO%G!<%?(B 23.5 $B$,%9%-%C%W$5(B
$B$l$F$$$^$9!%(B

\section{$B%9%H%j!<%`DL?.$H%W%m%;%9$NF14|(B}

$B<!$NNc$r9M$($^$7$g$&!%(B
\begin{verbatim}

        :- module sample3.
        :- public go/3, generate/2.

        go(Max,Even,Odd):- true |
                generate(Max,Numbers),                  %(3-1)
                sample1:furui(Numbers,Even,Odd).        %(3-2)

        generate(0,Numbers):- true |
                Numbers=[].
        otherwise.
        generate(N,Numbers):- true |
                Numbers=[N|NewNumbers],
                N1 := N-1,
                generate(N1,NewNumbers).

\end{verbatim}
$B%4!<%k(B go $B$NBh0l0z?t$KE,Ev$J<+A3?t$rM?$($k$H!$%4!<%k(B generate $B$,JQ?t(B 
Numbers $B$K$=$N?t$+$i(B 0 $B$^$G$N<+A3?t$N%j%9%H$r@8@.$7$^$9!%0lJ}!$(BNumbers 
$B$O%b%8%e!<%k(B sample1 $B$GDj5A$7$?%4!<%k(B furui $B$KEO$5$l!$(Bfurui $B$O(B Numbers 
$BCf$N<+A3?t$r6v?t$H4q?t$KJ,$1$^$9!%(B

$B$3$3$G!$(Bgenerate $B$d(B furui $B$N$h$&$K:F5"E*$J8F$S=P$7$K$h$C$F<B9T$5$l$k%4!<(B
$B%k$r%W%m%;%9$H8F$V$3$H$K$7$^$9!%(B

$B:#!$Fs$D$N%W%m%;%9(B (3-1),(3-2) $B$,0[$J$k%W%m%;%C%5>e$GJBNs$K<B9T$5$l$F(B
$B$$$k>l9g$r9M$($^$7$g$&!%$3$l$i$N%W%m%;%9$OF1$8JQ?t(B Numbers $B$r6&M-$7$F(B
$B$$$^$9!%%W%m%;%9(B generate $B$O$3$NJQ?t$r<!!9$H6qBN2=$7$F$$$-!$%W%m%;%9(B 
furui $B$O6qBN2=$5$l$?CM$r@hF,$+$i=g$K;2>H$7$F$$$-$^$9!%(B

$B$3$N$h$&$K!$(BKL1 $B$N%W%m%;%9$OF1$8JQ?t$r6&M-$9$k$3$H$K$h$C$F!$%G!<%?$NDL(B
$B?.$r9T$J$&$3$H$,$G$-$^$9!%$3$NNc$N$h$&$J%W%m%;%9F1;N$NDL?.$r%9%H%j!<%`(B
$BDL?.$H8F$S$^$9!%(B

furui $B$N<B9T$N?J$_J}$,Aa$$$H$-$O!$(Bfurui $B$O(B generate $B$,6&M-JQ?t(B Numbers 
$B$K%G!<%?$rEO$9$N$rBT$D$3$H$K$J$j$^$9!%$3$N$h$&$J>l9g$N=hM}$NBT$A9g$o$;(B
$B$O<+F0E*$K9T$J$o$l$^$9!%(B

$B$3$l$r6qBNE*$K@bL@$7$^$9!%%W%m%;%9(B furui $B$,8F$S=P$5$l$?;~!$Bh0l0z?t$,(B
$B6qBN2=$5$l$F$$$J$$$H!$(B
\begin{verbatim}
        furui(List,Even,Tail)                          %(1-6)
\end{verbatim}
$B$N8F$S=P$7$,!$(B(1-3),(1-4)$B$"$k$$$O(B(1-5)$B$K%^%C%A$7$?$H$-$K!$8F$S$@$7B&$N(B
$BJQ?t(B {\tt List} $B$r(B {\tt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in{verbatim}
        merge(In,Out)
\end{verbatim}
$B$3$3$G!$Bh0l0z?t$O!$(B
\begin{verbatim}
        In = { In1,In2, ... }
\end{verbatim}
$B$N$h$&$JG$0U8D$NF~NO%9%H%j!<%`$N%Y%/%?$G$9!%<!$K%^!<%8%c$r;HMQ$9$k%W%m(B
$B%0%i%`$NNc$r<($7$^$7$g$&!%(B
\begin{verbatim}

        :- module sample4.
        :- public flatten/2.
        flatten([],Out):- true|                 %(4-1)
                Out=[].
        flatten([Top|Tail],Out):- true|         %(4-2)
                flatten(Top,X1),
                flatten(Tail,X2),
                merge({X1,X2},Out).
        flatten(A,Out):- atom(A),A\=[]|         %(4-3)
                Out=[A].

\end{verbatim}
$B$3$N%W%m%0%i%`$O!$Bh0l0z?t$,F~$l;R$K$J$C$?%j%9%H$r<u$1$H$j!$$=$NCf$N%"(B
$B%H%`$r0l$D$N%j%9%H$H$7$FJV$7$^$9!%Nc$($P!$(B
\begin{verbatim}
        ?- sample3:flatten([a,[b,c],[d,[e,f]]],X).
\end{verbatim}
$B$r<B9T$9$k$H!$(B
\begin{verbatim}
        X = [ c,a,f,e,d,b ]
\end{verbatim}
$B$N$h$&$J7k2L$,F@$i$l$^$9!%(B
$B$3$3$G!$(Ba,b,c,\ldots $B$J$I$N%"%H%`$N=gHV$O%W%m%0%i%`$+$i7hDj$G$-$J$$$3(B
$B$H$KCm0U$7$^$7$g$&!%$3$l$O(B(4-2)$B$N@aCf$G8F$P$l$kFs$D$N(B "flatten" $B$N<B9T(B
$B$N=g=x$,Dj$^$i$J$$$+$i$G$9!%(B

$B%^!<%8%c$OF~NO%9%H%j!<%`(B {\tt X1, X2} $B$N$$$:$l$+$K%G!<%?$,E~Ce$9$k$H!$(B
$B$=$N%G!<%?$r=PNO%9%H%j!<%`$KJV$7$^$9!%%4!<%k(B{\tt flatten} $B$,Bh0l0z?t$N%G!<%?$r(B
$BA4$F>CHq$9$k$H@a(B(4-1)$B$,<B9T$5$l!$%^!<%8%c$NF~NO%9%H%j!<%`(B{\tt Out} $B$,(B{\tt
[] }$B$G6qBN2=$5$l$^$9!%$3$N$h$&$K!$%9%H%j!<%`$N(BCdr$BIt$,(B{\tt []}$B$G6qBN(B
$B2=$5$l$k$H!$%9%H%j!<%`$O(B"$BJD$8(B"$B$^$9!%%^!<%8%c$OF~NO%H%j!<%`$,A4$FJD$8$k(B
$B$H=PNO%9%H%j!<%`$rJD$6$7$F<B9T$r=*N;$7$^$9!%(B

sample3 $B$N%W%m%0%i%`(B (4-2) $B$,<B9T$5$l$kEY$K%^!<%8%c$r@8@.$7$^$9$,!$$3(B
$B$l$O%W%m%0%i%`$N<B9T8zN($K$H$C$F9%$^$7$/$"$j$^$;$s!%%W%m%0%i%`$r<!$N$h(B
$B$&$K2~$a$k$H!$$3$NLdBj$O2r7h$7$^$9!%(B
\begin{verbatim}

        :- module sample5.
        :- public flatten/2.
        flatten(In,Out):- true|
                flatten1(In,X),
                merge(X,Out).
        flatten1([],Out):- true|
                Out=[].
        flatten1([Top|Tail],Out):- true|
                flatten1(Top,X1),
                flatten1(Tail,X2),
                Out = {X1,X2}.
        flatten1(A,Out):- atom(A),A\=[]|
                Out=[A].

\end{verbatim}

\section{$B4JC1$JF~=PNO$NJ}K!(B}
$B$3$N@a$G$O(B KL1 $B%W%m%0%i%`$N%&%$%s%I%&5Z$S%U%!%$%k$KBP$9$k4JC1$JF~=PNO(B
$B$NJ}K!$r<($7$^$9!%3FF~=PNO$O$=$l$r9T$J$&$?$a$N%9%H!<%j!<%`$r3MF@$7$?(B
$B8e!$$=$3$K3F<o$N%a%C%;!<%8%W%m%H%3%k$rN.$9$3$H$K$h$C$F<B8=$G$-$^$9!%(B

$B3FF~=PNO$NJ}K!$N>\:Y$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B 3.5, 4, 5,
8.3 $B$r;2>H$7$F2<$5$$!%(B

\subsection{$BI8=`F~!&=PNO(B}
$BI8=`F~!&=PNO$rMQ$$$k$H!$%W%m%0%i%`$O%7%'%k$^$?$O%j%9%J$N%&%$%s%I%&$KBP(B
$B$7$FD>@\F~=PNO$r9T$J$&$3$H$,$G$-$^$9!%I8=`F~!&=PNO$K$O!$(B
\begin{quote}
$BI8=`F~NO!$I8=`=PNO!$I8=`F~=PNO!$%a%C%;!<%8=PNO!$I8=`%$%s%?%i%/%7%g%s(B
\end{quote}
$B$N#5<oN`$,$"$j$^$9!%(B

$BF~=PNO$r<B9T$9$k$K$O!$3F%G%P%$%9$X$N%9%H%j!<%`$r3MF@$9$kI,MW$,$"$j$^$9(B.  
$B$=$N%9%H%j!<%`$K(B
{\tt getc(C), putc(C)}$B$J$I$N%a%C%;!<%8$rAw$k$3$H$K$h$j=hM}$r9T$$$^$9(B.  
$B$3$l$i$N%a%C%;!<%8(B
$B$N>\:Y$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B3.5$B$r;2>H$7$F2<$5$$!%(B

$B$3$3$G$O!$I8=`F~NO!$I8=`=PNO!$%a%C%;!<%8=PNO$X$N%9%H%j!<%`$r3MF@$9$k$?(B
$B$a$N%W%m%0%i%`$NNc$H$7$F!$<!$N$h$&$J%b%8%e!<%k$rMQ0U$7$^$9!%(B

\begin{verbatim}

        :- module std_io.
        :- public create/3.
        :- with_macro pimos.

        create(Input,Output,Message):- true|
            shoen:raise(pimos_tag#shell,get_std_in,Input),
            shoen:raise(pimos_tag#shell,get_std_out,Output),
            shoen:raise(pimos_tag#shell,get_std_mes,Message).

\end{verbatim}
$B$3$N%b%8%e!<%k$r!$(B
\begin{verbatim}
        ?- std_io:create(Input,Output,Message),
           Input=[ ... ], Output=[ ... ], Message=[ ... ].
\end{verbatim}
$B$H8F$S=P$9$H!$(B

\begin{itemize}
\item Input $B$KI8=`F~NO$KBP$9$k%9%H!<%j!<%`$,F@$i$l!$(B\\
$[ \ldots ]$ $B$K$O(B{\tt buffer:input\_filter}$B$NDs6!$9$k%a%C%;!<%8$rAw$k$3$H(B
$B$,$G$-$^$9!%(B
\item Output $B$KI8=`=PNO$KBP$9$k%9%H!<%j!<%`$,F@$i$l!$(B\\
{\tt buffer:output\_filter}$B$NDs6!$9$k%a%C%;!<%8$rAw$k$3$H$,$G$-$^$9!%(B
\item Message $B$K%a%C%;!<%8=PNO$KBP$9$k%9%H!<%j!<%`$,F@$i$l!$(B\\
{\tt buffer:output\_filter}$B$NDs6!$9$k%a%C%;!<%8$rAw$k$3$H$,$G$-$^$9!%(B
\end{itemize}
$B%P%C%U%!5Z$S%U%#%k%?$K$D$$$F$O!$!V(BPIMOS $B%^%K%e%"%k!W(B3.5$B$r;2>H$7$F2<$5(B
$B$$!%(B

\subsection{$B?7$?$J%&%$%s%I%&$G$NF~=PNO(B}
$B%&%$%s%I%&$r?7$?$K@8@.$7!$$=$l$KBP$7$FF~=PNO$r9T$J$&$?$a$K!$<!$N$h$&$J(B
$B%b%8%e!<%k$rMQ0U$7$^$7$g$&!%(B

\begin{verbatim}

        :- module window.
        :- public create/1.
        :- with_macro pimos.

        create(Window):- true|
            shoen:raise(pimos_tag#task,
                general_request,General_Request_Device),
            General_Request_Device=
                [window(normal(Window_Request_Device,_,_))],
            Window_Request_Device=
                [create(normal(Window_Device,_,_))],
            Window_Device=[
                set_size(char(50,25),_),
%               set_size(mouse,_),
                set_position(mouse,_),
%               set_position(at(0,0),_),
                set_title("Interactive Window",_),
                activate(_)| Stream ],
            buffer:interaction_filter(Window,Stream).      %(5-1)

\end{verbatim}
$B$3$N%b%8%e!<%k$r<!$N$h$&$K8F$S=P$7$?$H$7$^$9!%(B
\begin{verbatim}
        ?- window:create(Window),
           Window=[ putl("Hit return to exit."), getl(_) ].
\end{verbatim}
$B$3$N$H$-!$2hLL$K%&%$%s%I%&$NOH$,8=$l$k$N$G!$%^%&%9$r%/%j%C%/$7$F>l=j$r(B
$BDj$a$F2<$5$$!%$3$N%&%$%s%I%&$K(B return $B$rF~NO$9$k$H%&%$%s%I%&$O>C$($^$9!%(B

$B$3$NNc$NJQ?t(B Window $B$,%&%$%s%I%&$KBP$7$FF~=PNO$r9T$J$&%a%C%;!<%8$rAw$k(B
$B$?$a$N%9%H%j!<%`$G$9!%(B(5-1) $B$N%U%#%k%?$K$h$C$F!$$3$N%9%H%j!<%`$K!$F~=P(B
$BNON>MQ%U%#%k%?(B( $B!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B.5.4$B;2>H(B )$B$N%f!<%6B&(B
$B%W%m%H%3%k$rAw$k$3$H$K$h$C$F%G!<%?$NF~=PNO$r9T$J$$$^$9!%(B

\subsection{$B%U%!%$%k$X$NF~=PNO(B}
$B%U%!%$%k$X$NF~=PNO$O!$%&%$%s%I%&$HF1MM%U%!%$%k$X$N%9%H%j!<%`$r3MF@$7$?(B
$B$"$H!$$=$3$K(B{\tt getc(C), putc(C)} $B$J$I$N%a%C%;!<%8$rAw$k$3$H$K$h$C$F(B
$B9T$J$$$^$9!%(B

$B%U%!%$%k$KBP$7$FF~=PNO$r9T$J$&$?$a$K!$<!$N$h$&$J%b%8%e!<%k$r:n$j$^$7$g(B
$B$&!%(B

\begin{verbatim}

        :- module file.
        :- public open/4.

        open(FileName,Mode,File,Status):- true|
            shoen:raise(pimos_tag#task,
                general_request,General_Request_Device),
            General_Request_Device=
                [file(normal(File_Request_Device,_,_))],
            File_Request_Device=
                [open(FileName,Access)],
            ( Mode=r ->                                   %(6-1)
                Access=read(Result),
                ( Result=normal(Stream,_,_) ->
                    buffer:input_filter(File,Stream),     %(6-2)
                    Status=success
                ; otherwise
                ; true -> Status=Result )
            ; Mode=w ->
                Access=write(Result),
                ( Result=normal(Stream,_,_) ->
                    buffer:output_filter(File,Stream),     %(6-3)
                    Status=success
                ; otherwise
                ; true -> Status=Result )
            ; Mode=a ->
                Access=append(Result),
                ( Result=normal(Stream,_,_) ->
                    buffer:output_filter(File,Stream),     %(6-4)
                    Status=success
                ; otherwise
                ; true -> Status=Result ) ).

\end{verbatim}
$B$3$3$G!$(B(6-1)$B$O<B9T$N>r7oJ,4t$N%^%/%m5-K!$G$9(B.  $B%^%/%m5-K!$K$D$$$F$O!$(B
$B!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B2.1.6$B$r;2>H$7$F2<$5$$!%(B

$B$3$3$KDj5A$5$l$F$$$k=R8l(B{\tt open(FileName, Mode, File, Status)}
$B$N3F0z?t$O<!$NDL$j$G$9!%(B
\begin{itemize}
\item FileName : $B%*!<%W%s$9$k%U%!%$%kL>(B( $B%9%H%j%s%07?(B )$B!%(B\\
{\tt "sample.kl1", ">sys>user>myname>sample.kl1"} $B$J$I!%(B

\item Mode : $B%*!<%W%s$N%b!<%I(B( r, w, a )$B$N;XDj!%(B\\
r $\rightarrow$ read, w $\rightarrow$ write, a $\rightarrow$ append
\item File : $B%*!<%W%s$7$?%U%!%$%k$X$N%9%H%j!<%`!%(B
\item Status : $B%*!<%W%s$N@.8y(B( success )/ $B<:GT(B( abnormal )$B$rJV$9JQ?t!%(B
\end{itemize}

$B$3$N=R8l$N8F$S=P$7$K$h$C$FJQ?t(B File $B$K$O%*!<%W%s$7$?%U%!%$%k$X$N%9%H%j!<(B
$B%`$,JV$5$l$^$9!%$3$l$KBP$9$kF~=PNO$N%a%C%;!<%8$O(B(6-2),(6-3),(6-4)$B$N%U%#(B
$B%k%?$N%5%]!<%H$9$k$b$N$,;HMQ$G$-$^$9!%(B
\begin{itemize}
\item Mode = r $B$N>l9g(B\\
{\tt buffer:input\_filter }$B$NDs6!$9$k%a%C%;!<%8!$(B
\item Mode = w, a $B$N>l9g(B\\
{\tt buffer:output\_filter }$B$NDs6!$9$k%a%C%;!<%8(B
\end{itemize}


\subsection{$BF~=PNO$rMxMQ$7$?%W%m%0%i%`$NNc(B}
$B0J2<$KF~=PNO$rMxMQ$7$?%W%m%0%i%`$NNc$r<($7$^$9!%(B
$B$3$N%W%m%0%i%`$r%3%s%Q%$%k$9$kA0$K!$>e$K<($7$?;0$D$N%b%8%e!<%k(B {\tt
std\_io, window, file} $B$r%3%s%Q%$%k$7$F$*$$$F2<$5$$!%$3$N%W%m%0%i%`$O(B
$B;XDj$7$?%U%!%$%k$NFbMF$r%&%$%s%I%&$KI=<($7$^$9!%%W%m%0%i%`$r!$(B
\begin{quote}
 {\tt ?- sample6:demo. }
\end{quote}
$B$G5/F0$9$k$H!$%U%!%$%kL>$rJ9$$$F$/$k$N$G!$E,Ev$J%U%!%$%kL>$rF~NO$7$F2<(B
$B$5$$!%$9$k$H!$%&%$%s%I%&$NOH$,8=$l$k$N$G!$%^%&%9$G0LCV$r7h$a$F2<$5$$!%(B
$B$=$N%&%$%s%I%&$K%U%!%$%k$NFbMF$,I=<($5$l$^$9!%(B

\begin{verbatim}

        :- module sample6.
        :- public demo/0.

        demo:- true|
            std_io:create(In,Out,Mes),
            In=[prompt("File name ? "),getl(FName)],
            Out=[putt('Openning file : '),putl(FName)],
            Mes=[putt(Status),nl],
            type_file(FName,Status).

        type_file(FName,St):- string(FName,_,_)|
            file:open(FName,r,File,St),
            ( St=success ->
                window:create(Win),
                File=[getl(Line)|RF],
                type(Line,RF,Win)
            ; otherwise
            ; true -> true ).

        type(-1,File,Win):- true|
            File=[],
            Win=[prompt("*** Hit Return key to exit.***"),
                    getl(_)].
        otherwise.
        type(L,File,Win):- true|
            Win=[putl(L),flush(_)|W],
            File=[getl(N)|F],
            type(N,F,W).

\end{verbatim}

\section{$B%G%C%I%m%C%/(B}
$B%9%H%j!<%`DL?.$H%W%m%;%9$NF14|$N@a$G=R$Y$?$h$&$K!$$"$k%4!<%k$N%\%G%#It(B
$B$N<B9T$,L$Dj5A$NJQ?t$r6qBN2=$7$h$&$H$7$?;~!$$=$N%4!<%k$N<B9T$OCfCG$5$l(B
$B$^$9!%(B

$B$"$k%4!<%k$,BT$C$F$$$kJQ?t$,!$B>$N$I$N%4!<%k$K$h$C$F$b6qBN2=$5$l$J$$;~!$(B
$BCfCG$5$l$?%4!<%k$N<B9T$O1J1s$K:F3+$5$l$^$;$s!%$3$N$h$&$J>uBV$r%G%C%I(B
$B%m%C%/$H8F$S$^$9!%(B

$B%G%C%I%m%C%/$OMM!9$J860x$G5/$-$k2DG=@-$,$"$j$^$9!%Nc$($P(B
sample4 $B$NNc$N(B(4-1)$B$N@a$r(B
\begin{verbatim}
                flatten([],[]):- true|true.               %(4-1')
\end{verbatim}
$B$H$9$k$H!$$3$N@a$H8F$S=P$7B&$N%4!<%k(B{\tt ?- flatten([],X1) }$B$,%^%C%A$7(B
$B$?;~!$8F$S=P$7B&$NJQ?t(B{\tt X1} $B$r(B {\tt []} $B$G6qBN2=$9$k%f%K%U%#%1!<%7%g(B
$B%s$,@8$8$k$N$G!$(BKL1 $B$N=hM}7O$O$3$N%f%K%U%#%1!<%7%g%s$rCfCG$7$^$9!%$H$3(B
$B$m$,!$JQ?t(B{\tt X1} $B$OB>$N%W%m%;%9$+$i6qBN2=$5$l$J$$$N$G!$%G%C%I%m%C%/(B
$B$r5/$3$7$^$9!%(B

$B$^$?!$F1$8@a$r<!$N$h$&$K5-=R$9$k$H!$(B
\begin{verbatim}
                flatten([],Out):- true|true.              %(4-1")
\end{verbatim}
$B%^!<%8%c$NF~NO$H$7$F;2>H$5$l$kJQ?t(B Out $B$,1J1s$K6qBN2=$5$l$:!$%G%C%I%m%C(B
$B%/$H$J$j$^$9!%$3$NNc$N$h$&$K!$(BKL1 $B$N@aCf$K0lEY$7$+8=$l$J$$JQ?t$,8m$C$F(B
$B@8$8$?>l9g!$$=$l$,%G%C%I%m%C%/$N860x$H$J$k2DG=@-$,$"$j$^$9!%$3$N$h$&$J(B
$BJQ?t$O!$(BCAL $B$NJQ?t%A%'%C%/$N5!G=$rMQ$$$FD4$Y$k$3$H$,$G$-$^$9!%(B( $BBh(B 
\ref{chap:CAL} $B>O(B $B;2>H(B )

$B%W%m%0%i%`$N<B9T;~$K%G%C%I%m%C%/$,@8$8$?>l9g$NBP=h$NJ}K!$O!$Bh(B 
\ref{chap:run} $B>O$r;2>H$7$F2<$5$$!%(B

\chapter{$BIi2YJ,;6(B}
\label{chap:parallel}
$BK\>O$G$O!$Ii2YJ,;6$NJ}K!$K$D$$$F4JC1$K@bL@$7$^$9!%8=:_$N(B PIMOS $B$G$O!$(B
$B%W%m%0%i%`$NIi2YJ,;6$O(B KL1 $B$N3F%4!<%kKh$K!$$=$l$r<B9T$9$k%W%m%;%C%5$N(B
$BHV9f$rM?$($k$3$H$G<B8=$7$^$9!%%W%m%;%C%5HV9f$rM?$($i$l$F$$$J$$%4!<%k$O!$(B
$B$=$l$r8F$S=P$7$?%4!<%k$HF1$8%W%m%;%C%5>e$G<B9T$5$l$^$9!%(B

\section{$BIi2YJ,;6$NJ}K!(B}
$BIi2YJ,;6$5$;$k$K$O!$3F%W%m%0%i%`$N%\%G%#It$N%4!<%k$KBP$7$F!$$=$N%4!<%k(B
$B$r<B9T$9$k%W%m%;%C%5HV9f$r<!$N$h$&$K;XDj$7$^$9!%(B
\begin{verbatim}
                goal@process($B%W%m%;%C%5HV9f(B)
\end{verbatim}
$B$3$3$G!$%W%m%;%C%5HV9f$O(B0$B0J>e$N@0?t$G$9!%(B
\begin{verbatim}
$B%W%m%0%i%`Nc(B
        :- module sample7.
        :- public foo/0.

        foo:- true |
                a@processor(0),
                a@processor(1),
                a@processor(2).
        a :- true | true.
\end{verbatim}
$B%W%m%;%C%5HV9f$OJQ?t$G$b;XDj$G$-$^$9!%JQ?t$,%W%m%;%C%5HV9f$K6qBN2=(B
$B$5$l$k$H!$$=$N%4!<%k$O$=$N%W%m%;%C%5$K0\F0@h$7$^$9!%(B
\begin{verbatim}
        :- module sample8.
        :- public foo/3.

        foo(P1,P2,P3):- true|
                a@processor(P1),
                a@processor(P2),
                a@processor(P3).
        a :- true | true.
\end{verbatim}

\section{$BIi2YJ,;6$NNc(B}
$B<!$K!$$b$&>/$76qBNE*$JIi2YJ,;6$NNc$r<($7$^$9!%(B
\begin{verbatim}

        :- module sample9.
        :- public distribute/1.

        distribute(N):- true |
                current_processor(_,X,Y),                 %(1)
                PEs := X*Y,                               %(2)
                fork(N, PEs, 0)@priority(*,4096).         %(3)

        fork(0, PEs, PE):- true | true.
        otherwise.
        fork(N, PEs, PE):- true |
                PeNo := PE mod PEs,
                job_ext@processor(PeNo),                  %(4)
                NextPE := PE+1,
                N1 := N-1,
                fork(N1, PEs, NextPE).

        job_ext :- true | job@priority(*,2000).           %(5)
        job :- true | true.

\end{verbatim}
(1)$B$OAH$_9~$_=R8l$G!$$=$l$,<B9T$5$l$F$$$k%W%m%;%C%5$NHV9f$H!$(BX,Y $B$=$l(B
$B$>$l$NJ}8~$N;HMQ$G$-$k%W%m%;%C%5$NBf?t$rJV$7$^$9!%(B\\
(2)$B$GF@$i$l$k(B{\tt `PEs'}$B$O!$;HMQ$G$-$k%W%m%;%C%5$NBf?t$G$9!%(B\\
(3)$B$G$OIi2YJ,;6$r9T$J$&%4!<%k(B{\tt 'fork'}$B$r:G9b$NM%@hEY$G8F$s$G$$$^$9!%(B
\\
( $BM%@hEY$N;XDj$K$D$$$F$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B2.1.4 $B$r;2>H(B
$B$7$F2<$5$$(B )$B!%(B\\
(4)$B$G$O!$<B:]$K;E;v$r$9$k%4!<%k$r3F%W%m%;%C%5$KEj$2$F$$$^$9!%(B\\
(5)$B$O<B:]$N;E;v$r$9$k%4!<%k$r(B{\tt `fork'}$B$h$j$bDc$$M%@hEY$G8F$s$G$$$^(B
$B$9!%(B
\vspace{3mm}

$B$3$N%W%m%0%i%`$KBP$7$F!$<!$N$h$&$J%4!<%k$r8F$V$H!$(B
\begin{verbatim}
        ?- sample9:distribute(8).
\end{verbatim}
$B%4!<%k(B{\tt `job' }$B$,(B 8 $B2s<B9T$5$l$^$9!%;HMQ$G$-$k%W%m%;%C%5$,2>$K(B 4 $BBf(B
$B$@$H$9$k$H!$3F%4!<%k$O!$%W%m%;%C%5HV9f$,(B{\tt 0,1,2,3,0,1,2,3 }$B$N=g$G%W(B
$B%m%;%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2YJ,;6$r9T$J$&%4!<%k$O!$<B:]$K;E;v$r$9$k%4!<%k$h$j$b9b$$M%@hEY(B
$B$G<B9T$9$k!%(B
\end{itemize}

$BIi2YJ,;6$K$D$$$F$N>\:Y$O(B $B!V(BKL1$B%W%m%0%i%_%s%0!W(B\cite{KL1}$B$N(B11.5$B$r;2>H$7(B
$B$F2<$5$$!%(B

\chapter{KL1 $B%W%m%0%i%`$N<B9TJ}K!(B}
\label{chap:run}
$B$3$N>O$G$O(B KL1 $B%W%m%0%i%`$N%3%s%Q%$%k!$<B9T!$%G%P%C%0!$$J$I$N<jB3$-$r(B
$B=g$rDI$C$F@bL@$7$^$9!%(B
\section{KL1$B%W%m%0%i%`$N%3%s%Q%$%k(B}
KL1 $B%W%m%0%i%`(B( $*$.kl1 $B%U%!%$%k(B)$B$r%3%s%Q%$%k$9$k$K$O!$(B
\begin{itemize}
\item PIMOS$B>e$N%;%k%U%3%s%Q%$%i(B
\item $B%/%m%9%7%9%F%`(BCAL
\end{itemize}
$B$N(B2$BDL$j$NJ}K!$,$"$j$^$9!%%W%m%0%i%`$N%G%P%C%0$NCJ3,$G$O(B PIMOS $B>e$N%;%k(B
$B%U%3%s%Q%$%i$r;HMQ$7$F2<$5$$!%(BCAL$B$K$D$$$F$O!$Bh(B \ref{chap:CAL} $B>O$G@bL@(B
$B$7$^$9!%(B

\section{$B%;%k%U%3%s%Q%$%i$N;H$$J}(B}
\subsection{$B%;%k%U%3%s%Q%$%i$N5/F0(B}
$B%3%s%Q%$%i$O(B PIMOS $B$N%7%'%k$+$i5/F0$7$^$9!%(B
$B$^$:!$(BPIMOS$B$r5/F0$7$F!$(BShellUser$B$G%m%0%$%s$7$F2<$5$$!%(B

\setlength{\unitlength}{1.1mm}
\begin{picture}(135,55)(-20,-22)
\footnotesize
\put(-20,20){\framebox(45,7)[l]{\tt USERS}}
\put(-20,-20){\framebox(45,40){}}
\put(-20,13){\makebox(50,7)[l]{~{\tt User Name>>ShellUser}}}
\put(25,20){\framebox(90,7)[l]{~{\tt Shell for ShellUser}}}
\put(25,-20){\framebox(90,47){}}
\put(25,13){\makebox(90,7)[l]{~{\tt Shell>}}}
\end{picture}

$B$3$3$G!$%+%l%s%H%G%#%l%/%H%j$r8+$^$9!%(B
\begin{verbatim}

        Shell> cd
        Illeegal filename for take .            : $BL5;k$7$F2<$5$$!%(B
        The value of the task:directory is "sys>user>Taro".
        Shell>

\end{verbatim}
$B%+%l%s%H%G%#%l%/%H%j$NJQ99$O!$%U%k%Q%9L>$r%9%H%j%s%0$G;XDj$7$F9T$$$^$9!%(B
\begin{quote}
 {\tt Shell>} \underline{\tt  cd "$B%G%#%l%/%H%jL>(B"}
\end{quote}
$B<!$K!$(B
\begin{quote}
 {\tt Shell> } \underline{\tt  compile}
\end{quote}

$B$HF~NO$7$F2<$5$$!%%7%'%k%&%$%s%I%&$+$i%3%s%Q%$%i!<$r5/F0$7$^$9!%(B
\begin{verbatim}

        ** KL1 Compiler **
        COMPILE>

\end{verbatim}
$B$3$N%W%m%s%W%H$K!$%3%s%Q%$%k$7$?$$%U%!%$%k$NL>A0$rF~NO$7$^$9(B( $BB0@-$N(B 
".kl1" $B$O>JN,$7$F2<$5$$(B )$B!%%U%!%$%k$,J#?t$"$k$H$-$O!$%+%s%^$G6h@Z$C$F0l(B
$BEY$KF~NO$G$-$^$9!%(B\\
$BNc$($P!$(B{\tt sample1.kl1, sample2.kl1, sample3.kl1} $B$r0lEY$K%3%s%Q%$%k(B
$B$9$k$K$O!$(B
\begin{quote}
 {\tt COMPILE>} \underline{\tt sample1, sample2, sample3}    
\end{quote}
$B$HF~NO$7$^$9!%(B\\
$B%+%l%s%H%G%#%l%/%H%j0J30$K$"$k%U%!%$%k$O%U%k%Q%9L>$r%9%H%j%s%0$GF~NO$7(B
$B$F2<$5$$!%%+%l%s%H%G%#%l%/%H%j$rJQ99$7$?$$>l9g$O!$(B{\tt !exit} $B$NF~NO$K(B
$B$h$C$F0lC6%3%s%Q%$%i$r=*N;$7!$(B{\tt cd} $B%3%^%s%I$GJQ99$7$?8e!$:F$S%3%s(B
$B%Q%$%i$r5/F0$7$F2<$5$$!%(B

\begin{description}
\small
\item $BCm0U(B : Psedo $B%^%k%A(BPSI$B$G$O%a%b%j$NMFNL$,ITB-$9$k>l9g$,$"$k$N$G!$(B
$BB?$/$N%U%!%$%k$rF1;~$K%3%s%Q%$%k$9$k$3$H$O$*4+$a$G$-$^$;$s!%%3%s%Q%$%k$O(B
$B2?2s$+$KJ,$1$F<B9T$G$-$^$9!%$?$@$7!$J,3d%3%s%Q%$%k$O0J2<$N$h$&$J86B'$K(B
$B=>$C$F<B9T$7$F2<$5$$!%(B
\end{description}
\begin{itemize}
\item $BAj8_$K;2>H$79g$&%U%!%$%k(B($B%b%8%e!<%k(B)$B$4$H$K%0%k!<%W$r:n$k!%%3%s%Q(B
$B%$%k$O%0%k!<%W$4$H$K<B9T$9$k!%(B
\item $B%3%s%Q%$%k$O2<0L$N%b%8%e!<%k$N%0%k!<%W$+$i<B9T$9$k!%$9$J$o$A!$$^(B
$B$:!$B>$r;2>H$7$J$$%0%k!<%W$r@h$K%3%s%Q%$%k$7!$<!$K!$4{$K%3%s%Q%$%k$5$l(B
$B$F$$$k%b%8%e!<%k$N$_$r;2>H$9$k%0%k!<%W$r%3%s%Q%$%k$9$k!%(B
\end{itemize}
$B%3%s%Q%$%k$N<B9TNc(B
\begin{verbatim}

        Compile File : **psi::>sys>**>sample1.kl1.1

        Compile Module : sample1
        furui/3
        Compile Succeeded : sample1

        Compile File : **psi***::>sys>***>sample2.kl1.1

        Compile Module : sample2
        check/2
        Compile Succeeded : sample2

        Compile File : **psi***::>sys>***>sample3.kl1.1

        Compile Module : sample3
        go/3
        generate/2
        Compile Succeeded : sample3

        "sample1" Loaded
        "sample2" Loaded
        "sample3" Loaded

        Compilation(s) Succeeded
        COMPILE> 

\end{verbatim}
$B$HI=<($5$l!$%3%s%Q%$%k$,40N;$7$^$9!%(B

$B%3%s%Q%$%i$r=*N;$9$k$K$O(B
\begin{quote}
{\tt COMPILE>}\underline{\tt  !exit}
\end{quote}
$B$rF~NO$7$F2<$5$$!%(B

\subsection{$B%P%C%A%3%s%Q%$%k(B}
\begin{quote}
{\tt Shell>} \underline{\tt compile(["sample1","sample2","sample3"])}
\end{quote}
$B$N$h$&$JF~NO$K$h$C$F!$%7%'%k%W%m%s%W%H$+$i%P%C%A%3%s%Q%$%k$r<B9T$9$k$3(B
$B$H$b$G$-$^$9!%%3%^%s%I%U%!%$%k(B( $BBh(B \ref{chap:Shell} $B>O;2>H(B )$B$rMQ$$$k>l9g(B
$B$J$I$KMxMQ$G$-$^$9!%(B

\section{$B%W%m%0%i%`$N<B9T(B}
$B%3%s%Q%$%k$7$?%W%m%0%i%`$N<B9T$O!$%j%9%J$"$k$$$O!$%7%'%k(B( $BBh(B 
\ref{chap:Shell} $B>O;2>H(B )$B$rMQ$$$F9T$J$$$^$9!%0J2<$G$O!$%j%9%J$rMQ$$$?(B
$B%W%m%0%i%`$N<B9T$H%G%P%C%0$NJ}K!$r@bL@$7$^$9!%(B

\subsection{$B%j%9%J$N5/F0(B}
$B%j%9%J$O<!$NFs$D$N$I$A$i$+$NJ}K!$G5/F0$G$-$^$9!%(B
\begin{itemize}
\item $BMxMQ4D6-@_Dj%&%$%s%I%&$K(B ListenerUser $B$G%m%0%$%s$7$^$9!%(B

\begin{picture}(130,55)(-20,-22)
\footnotesize
\put(-20,20){\framebox(45,7)[l]{~USERS}}
\put(-20,-20){\framebox(45,40){}}
\put(-20,13){\makebox(50,7)[l]{~{\tt User Name>> ListenerUser}}}
\end{picture}

\item Shell$B$+$i(B listener $B%3%^%s%I$G5/F0$7$^$9!$(B( $B$3$N>l9g$O!$%^%&%9$G(B
$B%j%9%J%&%$%s%I%&$N0LCV$HBg$-$5$r7h$a$^$9!%(B)

\begin{picture}(130,55)(-20,-22)
\footnotesize
\put(25,20){\framebox(90,7)[l]{~Shell for ShellUser}}
\put(25,-20){\framebox(90,47){}}
\put(25,13){\makebox(90,7)[l]{~{\tt Shell> listener \&}}}
\put(-20,20){\framebox(45,7)[l]{~USERS}}
\put(-20,-20){\framebox(45,40){}}
\put(-20,13){\makebox(50,7)[l]{~{\tt User Name>>}}}
\end{picture}
\end{itemize}
$B%7%'%k$+$i5/F0$7$?%j%9%J$O%8%g%V$H$7$F4IM}$G$-$k$N$G(B( $BBh(B 
\ref{chap:Shell}$B>O;2>H(B ), $BK|0l%W%m%0%i%`$,K=Av$7$F$b!$%j%9%J$r6/@)E*$K=*(B
$BN;$9$k$3$H$,$G$-$^$9!%$7$?$,$C$F!$%G%P%C%0;~$K$O%7%'%k$+$i5/F0$9$k$3$H(B
$B$r$*4+$a$7$^$9!%(B

\subsection{$B%4!<%k$N<B9T(B}
$B%j%9%J$O(B Prolog $B%$%s%?%W%j%?$H$h$/;w$?Lr3d$r2L$?$7$^$9!%(B
$B%4!<%k$OI,$:!$(B
\begin{quote}
?- $B%b%8%e!<%kL>(B:$B%4!<%k(B.
\end{quote}
$B$N7A$G8F$S$^$9!%(B
\begin{verbatim}

        ?- sample1:furui([1,2,3],E,O).
         E = [2]
         O = [1,3]
         yes.

\end{verbatim}
$B%j%9%J$N5/F0;~$K$OJQ?t%W!<%k(B($BBh(B \ref{chap:Listener} $B>O;2>H(B)$B$,F/$$$F$*$j!$(B
$B0lC6CM$NB+G{$5$l$?JQ?t(B( $B$3$NNc$G$O(B E $B$H(B O )$B$O$=$NCM$r;}$AB3$1$^$9!%(B
$B;n$7$K!$<!$N%f%K%U%#%1!<%7%g%s$r<B9T$7$F$_$^$7$g$&!%(B
\begin{verbatim}

        ?- X = [E,O].
         X = [[2],[1,3]]
         yes.

\end{verbatim}
$B8m$C$FJQ?t%W!<%k$KEPO?$5$l$F$$$kJQ?t$rMQ$$$FJL$N%4!<%k$r<B9T$9$k$H!$$=(B
$B$N%4!<%k$,<:GT$9$k$3$H$,$"$k$N$GCm0U$7$^$7$g$&!%(B\\
$BNc$($P!$>e$NNc$N(B E, O $B$rMQ$$$FJL$N%4!<%k(B furui $B$r<B9T$7$F$_$k$H!$(B
\begin{verbatim}
        ?-  sample1:furui([5,2,3],E,O).
         Unification failure>> 5
                        With > 1
                        Pe   > 0
        no.
\end{verbatim}
$B$N$h$&$K<:GT$7$^$9!%$3$l$O!$$9$G$K(B[1,3]$B$K6qBN2=$5$l$F$$$kJQ?t(B O $B$r(B{\tt
[5|Tail]} $B$H%f%K%U%!%$$7$h$&$H$7$?$3$H$K$h$j$^$9!%(B\\
$BJQ?t%W!<%k$KEPO?$5$l$F$$$kJQ?t$rA4$F2rJ|$9$k$K$O!$%T%j%*%I$rF~NO$7$^$9!%(B
\begin{quote}
{\tt ?- .}
\end{quote}
$BJQ?t%W!<%k$rI,MW$H$7$J$$>l9g$O!$(B{\tt forget.} $B$rF~NO$7$F2<$5$$(B
( $B$=$N5U$O(B{\tt remember.} $B$G$9(B )$B!%(B
\begin{quote}
{\tt ?-} \underline{\tt  forget.}
\end{quote}

\section{$B%W%m%0%i%`$N%G%P%C%0(B}
KL1 $B%W%m%0%i%`$N%G%P%C%0$N%D!<%k$H$7$F!$%H%l!<%5$H%$%s%9%Z%/%?$,MQ0U$5(B
$B$l$F$$$^$9!%(B

\subsection{$B%H%l!<%5(B}
KL1$B$N%4!<%k$K$O!$(BProlog $B$N$h$&$J<B9T$NC`<!@-$,$"$j$^$;$s(B.  $B$"$k;~E@$G(B
$B<B9T2DG=$J%4!<%k$O$I$l$G$b<B9T$5$l$k2DG=@-$,$"$j$^$9!%$=$3$G!$%j%9%J$+(B
$B$i5/F0$9$k%H%l!<%5$O!$$I$l$r%H%l!<%9$7$?$$$+(B( $B$"$k$$$OA4It(B )$B$r%f!<%6$,;X(B
$BDj$9$k$3$H$K$h$j(B, $BJBNs$K<B9T$5$l$kB>$N%4!<%k$H$O4X78$J$/(B, $B;XDj$5$l$?%4!<(B
$B%k$N<B9T$N$_$r%H%l!<%9$9$k$h$&$K$J$C$F$$$^$9!%(B
\vspace{3mm}

$B%H%l!<%5$N5/F0(B
\begin{quote}
{\tt ?-}~ \underline{\tt  trace.}

{\tt yes.}

{\tt \{trace\}}

{\tt ?-}
\end{quote}
$B%b%8%e!<%k(B sample3 $B$N=R8l(B {\tt go} $B$N<B9T$r%H%l!<%9$7$F$_$^$9!%(B
\begin{verbatim}

      ?- sample3:go(3,E,O).
       @0@4096 0   sample3:go(3,A,B)              (a)
       1     * (1)   generate(3,C)                (b)
       2     * (2)   sample1:furui(C,A,B)?        (c)

\end{verbatim}
(a)$B$N9T$N(B{\tt @0@4096 0} $B$N:G=i$N(B 0 $B$O$=$N%4!<%k$r%l%G%e!<%9$7$?%W%m%;%C(B
$B%5$NHV9f!$<!$N(B {\tt 4096} $B$O%4!<%k$N%W%i%$%*%j%F%#!$$=$N<!$N(B 0 $B$O%4!<(B
$B%k$KM?$($i$l$?<1JLHV9f$G$9!%(B\\
(b)$B$H(B(c)$B$N9T$O!$%4!<%k(B{\tt go} $B$N;R%4!<%k$NI=<($G$9!%3F9T$N@hF,$N(B {\tt
1, 2} $B$O%4!<%k$N<1JLHV9f!$<!$N(B{\tt *} $B$O$3$l$+$i$=$N%4!<%k$r%H%l!<%9$9(B
$B$k$3$H$r<($90u$G$9!%$=$N<!$N(B {\tt (1),(2)} $B$O%H%l!<%9%3%^%s%I$rE,MQ$9(B
$B$k;R%4!<%k$r;XDj$9$k$?$a$NHV9f$G$9(B( $B%H%l!<%5$NI=<($N>\:Y$K$D$$$F$O(B
$B!V(BPIMOS $B%^%K%e%"%k!W(B10.6.2$B$r;2>H$7$F2<$5$$(B )$B!%(B

$B>e$NNc$G$O!$(B{\tt (1),(2)} $B$N$I$A$i$N;R%4!<%k$b%H%l!<%9%b!<%I$,;XDj$5$l(B
$B$F$$$^$9$,!$%H%l!<%9$9$kI,MW$N$J$$;R%4!<%k$NHV9f$r(B
\begin{quote}
{\tt t N1,N2,...}
\end{quote}
$B$N$h$&$KF~NO$9$k$H$=$NHV9f$G;XDj$5$l$?;R%4!<%k$N%H%l!<%9%b!<%I$,H?E>$7(B
$B$^$9!%(B\\
$BNc$($P!$(B(c)$B$N%W%m%s%W%H(B{\tt ?} $B$KBP$7$F!$<!$N$h$&$KF~NO$9$k$H!$(B
\begin{verbatim}

       2     * (2)   sample1:furui(C,A,B)? t 1    (c)
       @0@4096 0   sample3:go(3,A,B)
       1       (1)   generate(3,C)                (d)
       2     * (2)   sample1:furui(C,A,B)?        (e)

\end{verbatim}
(d)$B$N9T$N(B{\tt *} $B0u$,>C$($^$9!%$3$l$G;R%4!<%k(B (1) $B$N%H%l!<%9$O(B
$BM^@)$5$l$^$9!%(B( $B$b$&0lEY(B{\tt t 1} $B$rF~NO$9$k$H$b$H$KLa$j$^$9!%(B)

$B<!$K!$(B(e)$B$N%W%m%s%W%H$G(B return $B$rF~NO$9$k$H!$<B9T$,7QB3$7$^$9!%(B
\begin{verbatim}

       @0@4096 2   sample1:furui([3,2,1],A,B)
                       B= [3|D]
       3     * (1)     furui([2,1],A,D)?

\end{verbatim}
$B$3$3$G!$$3$N<B9T2aDx$r$3$l0J>e%H%l!<%9$9$kI,MW$,$J$$>l9g$O!$(B{\tt x} $B%3(B
$B%^%s%I$rF~NO$7$^$9!%$3$l$K$h$C$F!$;R%4!<%k$N%H%l!<%9%b!<%I$,H?E>$5$l!$(B
$B<B9T$,7QB3$7$^$9!%(B
\begin{verbatim}

       3     * (1)     furui([2,1],A,D)? x
        E = [2]
        O = [1,3]
       yes.
       ?-

\end{verbatim}
$B$3$NNc$G$O!$%H%l!<%9$,=*N;$7$^$9!%%H%l!<%9%b!<%I$,;XDj$5$l$F$$$k%4!<%k(B
$B$,B>$K$b$"$k>l9g$O!$$=$N<B9T2aDx$r%H%l!<%9$7$^$9!%(B

$BA4$F$N%4!<%k$N%H%l!<%9$d$a$k$K$O%3%^%s%I(B{\tt notrace} $B$rF~NO$7$^$9!%(B\\
$B$^$?!$%X%k%W%a%K%e!<$O(B{\tt help} $B$GI=<($5$l$^$9!%(B\\
$B%H%l!<%9%3%^%s%I$N>\:Y$O!V(BPIMOS$B%^%K%e%"%k!W(B10.6.3$B$r;2>H$7$F2<$5$$!%(B

$B%H%l!<%5$r=*N;$9$k$K$O!$(B
\begin{quote}
{\tt ?-}~ \underline{\tt  notrace.} ( ntr.$B$G$b$h$$!%(B)
\end{quote}
$B$HF~NO$7$^$9!%(B

$B%H%l!<%5$K$O!$I,MW$J%4!<%k$N$_$r%H%l!<%9$9$k$?$a$N5!G=$H$7$F!$Fs<oN`$N(B
$B%9%Q%$5!G=$,MQ0U$5$l$F$$$^$9!%(B
\begin{itemize}
\item $B%j%@%/%7%g%s%9%Q%$(B\\
$B;XDj$7$?%4!<%k$,%j%G%e!<%9$5$l$?$H$-$K!$$=$l$rJs9p$7$^$9!%(B
\item $B%U%)!<%/%9%Q%$(B\\
$B;XDj$7$?%4!<%k$r;R%4!<%k$H$7$F;}$D%4!<%k$r%j%G%e!<%9$7$?$H$-$K!$$=$l$r(B
$BJs9p$7$^$9!%(B
\end{itemize}
$B%9%Q%$%4!<%k$N;XDj$O!$(B
\begin{quote}
{\tt ?-}~ \underline{\tt  spy $B%b%8%e!<%kL>(B:$B=R8lL>(B/$B0z?t$N?t(B.}
\end{quote}
$B$N$h$&$K9T$J$$$^$9!%<!$K!$%9%Q%$$N%b!<%I$r;XDj$7$^$9!%(B
\begin{quote}
{\tt ?-}~ \underline{\tt  spy\_reduction.} ( {\tt sr.}$B$G$b$h$$!%(B)\\
$B$"$k$$$O!$(B\\
{\tt ?-}~ \underline{\tt  spy\_fork.} ( {\tt sf.}$B$G$b$h$$!%(B)
\end{quote}
$B%9%Q%$$N<B9TNc(B
\begin{verbatim}

       ?- spy sample1:furui/3.
       Spypoint set on sample1:furui/3
        yes.

       ?- sr.
        yes.

       {SpyReduction} 
       ?- sample3:go(3,E,O).
       <0> sample3:go(3,A,B) -->
       @0@4096     + sample1:furui([3,2,1],A,B)
                         B=[3|C]
       1   + * (1)     furui([2,1],A,C)?

\end{verbatim}
$B%9%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l$F$$$kJQ?t$N%j%9%H$O!$(B
\begin{quote}
{\tt ?-}~~\underline{\tt list.}
\end{quote}
$B$NF~NO$K$h$C$FI=<($G$-$^$9!%Nc$($P!$JQ?t(B {\tt X} $B$N%G!<%?$rD4$Y$?$$$H(B
$B$-!$(B
\begin{quote}
{\tt ?-}~~\underline{\tt  inspect(X)}
\end{quote}
$B$H$7$F%$%s%9%Z%/%?$r5/F0$7$^$9!%$3$l$KBP$7$F!$$3$3$G!$JQ?t(B X $B$K(B
\{1,2,3,a(b)\} $B$,B+G{$5$l$F$$$k$H$9$k$H!$$=$l$,<!$N$h$&$KI=<($5$l$^(B
$B$9!%(B
\begin{verbatim}
        {1,2,3,a(b)}>
\end{verbatim}
$B$3$3$G!$$3$N%G!<%?$KBP$7$F!$%$%s%9%Z%/%?$NDs6!$7$F$$$k%G!<%?D4::%3%^%s(B
$B%I$,E,MQ$G$-$^$9!%$^$?!$%$%s%9%Z%/%?$N@)8f%3%^%s%I(B( exit $B$J$I(B )$B$bE,MQ(B
$B$G$-$^$9!%Nc$($P!$$3$N%G!<%?$N(B3$BHVL\$NMWAG(B( $B:G=i$NMWAG$O(B0$BHVL\(B )$B$rI=<($9(B
$B$k$K$O!$<!$N$h$&$K%3%^%s%I(B{\tt me} $B$rMQ$$$^$9!%(B
\begin{verbatim}
        {1,2,3,a(b)} > me 3
        3 : a(b)
\end{verbatim}

\item $B%H%l!<%9$NESCf$+$i$N5/F0(B\\
$B%H%l!<%9$NESCf$+$i%$%s%9%Z%/%?$r5/F0$9$k$K$O!$(B
\begin{quote}
  {\tt ins} $B%4!<%kHV9f(B
\end{quote}
$B$rF~NO$7$^$9(B( $B%4!<%kHV9f$O>JN,2DG=$G$9(B )$B!%(B\\
$BNc(B
\begin{verbatim}

      ?- sample3:go(3,E,O).
       @0@4096 0   sample3:go(3,A,B)
       1     * (1)   generate(3,C)
       2     * (2)   sample1:furui(C,A,B)? ins 1
       generate(3,A)>

\end{verbatim}
\end{itemize}
$B%$%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PIMOS $B$G$O%"%s%m!<%@$rDs6!$7$F$$(B
$B$^$9!%(B

$B%"%s%m!<%@$O%7%'%k$G<B9T$7$^$9!%(B
\begin{quote}
{\tt Shell>}\underline
{\tt unload([sample1,sample2,\ldots],"module.unl")}
\end{quote}
$B$3$l$K$h$C$F!$(Bsample1, sample2, \ldots $B$N%3%s%Q%$%k7k2L$r(B "module.unl" 
$B$H$$$&%U%!%$%k$KJ]B8$7$^$9!%(B

$B%"%s%m!<%@$GJ]B8$7$?%b%8%e!<%k$N>pJs$r(B PIMOS $B>e$K:\$;$k$K$O%m!<%@$r;H(B
$BMQ$7$^$9!%(B

$B%m!<%@$b%7%'%k$G<B9T$7$^$9!%(B
\begin{quote}
{\tt Shell>}\underline{\tt  load("module.unl")}
\end{quote}
$B$3$l$K$h$C$F!$(Bsample1, sample2, \ldots $B$N%b%8%e!<%k$r%7%'%k$d%j%9%J$+(B
$B$i8F$V$3$H$,$G$-$^$9!%(B

\section{$B%G%C%I%m%C%/$NBP=hK!(B}
$B<B9T$7$F$$$k%W%m%0%i%`$,=*N;$7$J$$>l9g$O(B, $B%G%C%I%m%C%/$,@8$8$F$$$k2DG=(B
$B@-$,$"$j$^$9(B.  $B%G%C%I%m%C%/$O%,!<%Y%C%8!&%3%l%/%7%g%s$N$H$-$K8!=P$5$l(B
$B$^$9$,!$%,!<%Y%C%8!&%3%l%/%7%g%s$O%a%b%j$N6u$-NN0h$,ITB-$7$J$$8B$j<+F0(B
$BE*$K$O5/F0$5$l$^$;$s!%$=$3$G!$<!$N$h$&$J>u67$,$*$-$?>l9g$K$O%G%C%I%m%C(B
$B%/$N5?$$$,$"$k$H$7$F!$%,!<%Y%C%8!&%3%l%/%?$r%3%^%s%I$K$h$j5/F0$7$F2<$5(B
$B$$!%(B

\begin{itemize}
\item CSP $B%3%s%=!<%k%Q%M%k(B($B!V(BCSP$BA`:n@bL@=q!W(B\cite{CSP}7.2$B;2>H(B )$B$N(B 
Silent Mode $B$,(B OFF $B$G!$>uBV4F;k%Q%M%k$,9u$/$J$C$F$$$k!%(B

\item $B%W%m%0%i%`$N<B9T$r(B {\tt Control-C} $B$G2?2s$+CfCG$7!$%3%^%s%I(B{\tt
r }$B$rF~NO$7!$%j%@%/%7%g%s?t$rD4$Y$F$bCM$,A}2C$7$J$$(B( $BBh(B 
\ref{chap:Listener} $B>O;2>H(B )$B!%(B
\end{itemize}

\subsection{$B%,!<%Y%8%3%l%/%?$N5/F0(B}
$B%,!<%Y%8%3%l%/%?$r5/F0$9$k$K$O!$<!$NFsDL$j$NJ}K!$,$"$j$^$9!%(B
\begin{itemize}
\item $B%j%9%J$K(B{\tt Control-C} $B$rF~NO$7!$(B{\tt g} $B%3%^%s%I$G5/F0$9$k!%(B
\item $B%7%'%k$K(B{\tt gc} $B$rF~NO$7$F5/F0$9$k!%(B
\end{itemize}
GC $B$O$I$3$+$i5/F0$7$F$b$+$^$$$^$;$s!%%G%C%I%m%C%/$,8!=P$5$l$k$H!$%W%m(B
$B%0%i%`$r<B9T$7$?%&%$%s%I%&$KJs9p$5$l$^$9!%(B( $B%7%'%k$KJs9p$5$l$k>l9g$O!$(B
$B%W%m%s%W%H(B {\tt Shell>}$B$K(B return $B$rF~NO$7$F2<$5$$!%(B)

\section{$B%W%m%0%i%`$NI>2A(B}
PIMOS $B$G$O!$(BKL1 $B%W%m%0%i%`$N<B9T;~$N@-G=$rI>2A$9$k$?$a$K!$0J2<$N5!G=$r(B
$BDs6!$7$F$$$^$9!%(B

\begin{itemize}
\item $B%?%9%/$N;q8;>CHqNL(B( reduction $B?t(B )$B5Z$S!$<B9T;~4V$NI=<((B\\
$B%j%9%J$G!$(B
\begin{quote}
{\tt ?-} \underline{\tt statistics.} ( st. $B$G$b$h$$!%(B)
\end{quote}
$B$rF~NO$9$k$H!$%?%9%/$N;q8;>CHqNL$*$h$S<B9T;~4V$rI=<($9$k%b!<%I$K(B
$BF~$j$^$9!%(B
\begin{verbatim}

      ?- sample3:go(3,E,O).
       E = [2]
       O = [1,3]
       24 reductions
       118 msec
       yes.

\end{verbatim}
( $BI=<(%b!<%I$N2r=|$O(B nostatistics. $B$^$?$O(B nst. $B$G$9!%(B)
\item $B%Q%U%)!<%^%s%9!&%a!<%?(B ( Pseudo Multi PSI $B$G$O;H$($^$;$s!%(B)\\
$B%^%k%A(B PSI $B$N3F(B CPU $B$N2TF/N($rI=<($9$k$?$a$N%D!<%k$H$7$F!$%Q%U%)!<%^%s(B
$B%9!&%a!<%?$,MQ0U$5$l$F$$$^$9!%(B
$B%Q%U%)!<%^%s%9!&%a!<%?$O%7%'%k$+$i5/F0$7$^$9!%(B
\begin{quote}
 {\tt Shell>} \underline{\tt pmeter}
\end{quote}
$B>\:Y$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$BIUO?(B B$B$r;2>H$7$F2<$5$$!%(B
\end{itemize}

\chapter{$B%H%i%V%kBP=hK!(B}
\label{chap:trouble}
$B$3$N>O$G$O!$%f!<%6$N(B KL1 $B%W%m%0%i%`$K$h$C$F(B PIMOS $B$"$k$$$O(B SIMPOS $B$K%H(B
$B%i%V%k$,@8$8$?>l9g$NBP=hK!$K$D$$$F4JC1$K@bL@$7$^$9!%%H%i%V%kBP=h$N>\:Y(B
$B$J@bL@$O!V(BCSP $BA`:n@bL@=q!W(B\cite{CSP}$B$NBh(B12$B>O$r;2>H$7$F2<$5$$!%(B

\section{PIMOS $B>e$N%H%i%V%k(B}
\begin{itemize}
\item KL1 $B$N%W%m%0%i%`$NK=Av$d$=$NB>$NM}M3$G!$(BPIMOS $B$,@5>o$KF0:n$7$J(B
$B$/$J$C$?>l9g!$(BCSP $B%3%^%s%I%&%$%s%I%&$K(B{\tt Control-C} $B$rF~NO$7$F2<$5$$!%(B
$B%W%m%s%W%H(B{\tt \$}$B$,8=$l$^$9!%(B{\tt \$}$B$,8=$l$J$$$H$-(B, $B$D$^$j(B
{\tt Control-C}$B$,Mx$+$J$$>l9g$O!$:8>e$N(B
$B>uBV4F;k%Q%M%k$r%^%&%9$G%/%j%C%/$7$?8e!$(B{\tt ABORT} $B%-!<$rF~NO$7!$8=$l(B
$B$?%a%K%e!<$G!$(B{\tt Return to CSP Toplevel} $B$rA*Br$7$F2<$5$$!%%W%m%s%W(B
$B%H$,8=$l$?$i!$(B{\tt exit} $B%3%^%s%I(B
\begin{quote}
 {\tt \$ exit}
\end{quote}
$B$G0lC6(B CSP $B$r=*N;$7!$%7%9%F%`%a%K%e!<$+$i(B(Pseudo) Multi-PSI $B$r5/F0$7$J(B
$B$*$7$F2<$5$$!%(B
\item KL1 $B$N%W%m%0%i%`$N<B9TCf$K%a%b%j$NITB-$d!$$=$NB>$N%(%i!<$,860x$G(B 
PIMOS $B$,Dd;_$7!$(BCSP $B%3%^%s%I%&%$%s%I%&$K%W%m%s%W%H(B{\tt \$} $B$,8=$l$?>l(B
$B9g$bF1MM$K$7$F(B PIMOS $B$r:F5/F0$7$F2<$5$$!%(B

\item $B%a%b%j$NITB-$K$h$C$F(B PIMOS $B$,Dd;_$7$?>l9g!$(BCSP $B%3%^%s%I%&%$%s%I(B
$B%&$K!$(B
\begin{verbatim}
        Copying GC Memory Shortage : xxx words
\end{verbatim}
$B$H$$$&%(%i!<%a%C%;!<%8$,I=<($5$l$^$9!%(BPseudo Multi-PSI $B$G$O$3$N$h$&$J(B
$B>l9g!$%3%s%U%#%.%e%l!<%7%g%s%U%!%$%k$rJQ99$7$F!$;HMQ$9$k%W%m%;%C%5$NBf(B
$B?t$r8:$i$7$F$/$@$5$$(B.  $B0lC6%7%c%C%H%@%&%s$7$F(B PIMOS $B$rN)$A>e$2$J$*$9$H!$(B
$BF1$8%W%m(B
$B%0%i%`$,@5>o$KF0:n$9$k>l9g$b$"$j$^$9!%%3%s%U%#%.%e%l!<%7%g%s%U%!%$%k$N(B
$BJQ99$K$D$$$F$O!$!V(BCSP $BA`:n@bL@=q!W(B\cite{CSP}$B$NBh(B4$B>O!$(B6$B>O$r;2>H$7$F2<$5(B
$B$$!%(B
\end{itemize}

\section{SIMPOS $B>e$N%H%i%V%k(B}
$B%f!<%6$N(B KL1 $B%W%m%0%i%`$N<B9T$K2?$i$+$N>c32$,5/$3$k$H!$(BSIMPOS $B$,Dd;_$9(B
$B$k>l9g$,$"$j$^$9!%$3$N;~!$(BPSI-II $B$N(B CSP $B$K@)8f$,0\$j!$%3%s%=!<%k%&%$%s(B
$B%I%&(B( PSI $B$NN)$A>e$2;~$KI=<($5$l$k%&%$%s%I%&(B )$B$,8=$l$F!$<!$N$h$&$J!$%a%C(B
$B%;!<%8$H%W%m%s%W%H(B{\tt \$} $B$,I=<($5$l$^$9!%(B
\begin{verbatim}
        %F-SRGHLT, CPU HALT BY STOP REGISTER

        MPC = ....              PMPC = ....
        CIR0 = ....
        CIR1 = ....

          ....................

        $
\end{verbatim}
$B$3$N$h$&$J>l9g$NBP=hK!$r0J2<$K<($7$^$9!%(B

\begin{enumerate}
\item SIMPOS $B$N%3%s%=!<%k$N%W%m%s%W%H$G(B {\tt deb} $B%3%^%s%I$rF~NO$7!$%G(B
$B%P%C%0%b!<%I$KF~$j$^$9!%(B
\begin{quote}
{\tt \$deb}
\end{quote}
\item $B%W%m%s%W%H$,(B {\tt >} $B$KJQ$o$k$N$G!$$3$3$G!$(B{\tt go} $B$HF~NO$7(B
$B$^$9!%(B
\begin{quote}
{\tt >go}
\end{quote}
\item {\tt CTRL}$B%-!<$H(B {\tt BREAK}$B%-!<$rF1;~$K2!$9$H!$%3%s%=!<%k%&%$%s(B
$B%I%&$,1#$l$^$9!%(B(Pseudo) $B%^%k%A(B PSI $B$N(B CSP $B%3%^%s%I%&%$%s%I%&(B
$B$KLa$C$F2<$5$$!%(B
\item CSP $B%3%^%s%I%&%$%s%I%&$K%W%m%s%W%H(B{\tt \$} $B$,I=<($5$l$F$$$J$$>l(B
$B9g$O(B{\tt Control-C}$B$rF~NO$7$F%W%m%s%W%H(B {\tt \$ }$B$KLa$j$^$9!%(B
\item $B$3$N%W%m%s%W%H$KBP$7!$(B{\tt exit} $B%3%^%s%I$G(B CSP $B$r=*N;$7$^$9!%(B
\begin{quote}
 {\tt \$exit}
\end{quote}
\item $B%7%9%F%`%a%K%e!<$+$i$b$&0lEY(B (Pseudo) Multi-PSI $B$r5/F0$9$k$H!$(B
PIMOS $B$O@5>o$KF0$-$^$9!%(B
\end{enumerate}

\begin{itemize}
\item $B>e$N(B 4,5 $B$NA`:n$G!$(B(Pseudo) Multi-PSI $B$r=*N;$G$-$J$$>l9g$O!$(BSIMPOS$B$N(B
$B%7%9%F%`%a%K%e!<$+$i(B{\tt process}$B$rA*Br$7!$%W%m%;%9%^%K%e%T%e%l!<%?(B($B!V(BSIMPOS
$BA`:n@bL@=q!W(B\cite{SIMPOS}$B;2>H!%(B) $B$r5/F0$7(B, {\tt 
(Pseudo\_)multi\_psi\_main\_program}$B$KBP$7$F!$(B{\tt exterminate}$B$r<B9T(B
$B$7$?8e!$(BSIMPOS $B$r%7%c%C%H%@%&%s$7$F2<$5$$!%(B
\item $B>e$N(B 3 $B$NA`:n$G!$(BSIMPOS$B$,@5>o$KF0:n$7$J$$>l9g$O!$(B{\tt BREAK} 
$B%-!<$r2!$7$F(B SIMPOS $B$N%3%s%=!<%k$N%W%m%s%W%H(B{\tt '>'} $B$KLa$j$^$9!%$=$N(B
$B8e!$<!$N<j=g$G(B SIMPOS $B$r%7%c%C%H%@%&%s$7$?8e!$(BSIMPOS $B$r:F5/F0$7$F2<$5$$!%(B
\begin{quote}
{\tt >go/tr}\\
{\tt @q simpos}\\
{\tt @}$<cr>$\\
{\tt DC> OK to SHUT DOWN ?? [Y/N] -> [1/0]}\\
{\tt RC> 1}\\
.........\\
{\tt >q}\\
{\tt \$bo}
\end{quote}
\item $B0J>e$NA`:n$,A4$F<B9T$G$-$J$$>l9g$O!$%j%;%C%H%\%?%s$r2!$7$F2<$5$$!%(B
\end{itemize}

\chapter{$B%7%'%k(B}
\label{chap:Shell}
$B$3$N>O$G$O!$%7%'%k$N<g$J5!G=$K$D$$$F4JC1$K@bL@$7$^$9!%(B

\section{$B=i4|2=%U%!%$%k$N@_Dj(B}
$BBh(B \ref{chap:setup} $B>O$G<($7$?MxMQ4D6-@_Dj%U%!%$%k$NJQ99$K$h$C$F!$%7%'%k(B
$B5/F0;~$N=i4|%G%#%l%/%H%j$O!$3F%f!<%6$N%[!<%`%G%#%l%/%H%j$K@_Dj$5$l$^$9!%(B
$B$=$N%G%#%l%/%H%j$N2<$K!$(B
\begin{quote}
{\tt shell.com}
\end{quote}
$B$H$$$&%U%!%$%k$r:n$j!$$=$3$K%7%'%k$N4D6-JQ?t$N@_Dj$d!$%3%^%s%I$r=q$-9~(B
$B$s$G$*$/$H!$%7%'%k$N5/F0;~$K$=$N%3%^%s%I$,<+F0E*$K<B9T$5$l$^$9!%(B\\
{\tt "shell.com"} $B$NNc(B
\begin{verbatim}
        set history = 20
        set rscinc = infinite
        set prompt = "% "
        listener(mouse,char(50,20),"font:test_11") &
\end{verbatim}
$B$3$NNc$G$O!$%7%'%k5/F0;~$K0J2<$,<B9T$5$l$^$9!%(B
\begin{itemize}
\item $B%R%9%H%j!<%9%?%C%/$ND9$5$r(B 20 $B$H$9$k!%(B
\item $B;q8;ITB-;~$KDI2C$9$k;q8;NL(B($B!V(BPIMOS $B%^%K%e%"%k!W(B8.2.6 $B;2>H(B )$B$r(B 
infinite $B$H$9$k!%(B
\item $B%W%m%s%W%H$r(B "\% "$B$H$9$k!%(B
\item $B%j%9%J$r%P%C%/%0%i%&%s%I$G5/F0$9$k!%(B
\end{itemize}

\section{$B%7%'%k$N4pK\E*$J%3%^%s%I(B}
\begin{itemize}
\item $B%7%'%k$N=*N;(B\\
{\tt Shell> exit}
\item $B%+%l%s%H%G%#%l%/%H%j$NJQ99(B\\
{\tt Shell> cd ">sys>csp>SYSTEM.DIR"}
\item $B%3%^%s%I%U%!%$%k(B( $B<B9T$7$?$$%7%'%k%3%^%s%I$r=q$-9~$s$@%U%!(B
$B%$%k(B)$B$N<B9T(B\\
{\tt Shell> take  "test.com"}
\item $B%3%^%s%I0lMw$NI=<((B\\
{\tt Shell> help}
\end{itemize}

\section{$B%R%9%H%j!<5!G=(B}
$B%R%9%H%j!<5!G=$r;H$&$?$a$K$O!$$^$:%R%9%H%j!<%9%?%C%/$ND9$5$r@_Dj$7$^$9!%(B
\begin{quote}
{\tt Shell> set history=20}
\end{quote}
$B$3$N@_Dj$O=i4|2=%U%!%$%k$K=q$-9~$s$G$*$/$HJXMx$G$9!%(B\\
$B%R%9%H%j!<%9%?%C%/$NFbMF$O!$(B
\begin{quote}
{\tt Shell> history}
\end{quote}
$B$GI=<($5$l$^$9!%(B\\
$B%R%9%H%j!<%9%?%C%/$N%3%^%s%I$O!$I=<($5$l$?%3%^%s%I$NHV9f$rF~NO$9$k$H<B(B
$B9T$G$-$^$9!%$?$@$7!$D>A0$N%3%^%s%I$O(B 0 $B$rF~NO$9$k$H<B9T$G$-$^$9!%(B
\begin{quote}
{\tt Shell> 3}
\end{quote}

\section{$B%?%9%/$N<B9T(B}
$B%7%'%k$N%W%m%s%W%H$G$O!$%7%'%k%3%^%s%I$H(B KL1 $B$N%4!<%k$r<B9T$9$k$3$H$,(B
$B$G$-$^$9!%(B( $B$?$@$7!$%7%'%k$+$i$N%4!<%k$N8F$S=P$7$K$O!$JQ?t$rMQ$$$k$3$H(B
$B$,$G$-$^$;$s!%$^$?!$=R8lL>$,(B{\tt go} $B$GM?$($i$l$F$$$k%4!<%k$N8F$S=P$7(B
$B$O!$(B{\tt go} $B$r>JN,$7!$%b%8%e!<%kL>$H0z?t$N$_$G$=$N%4!<%k$r8F$V$3$H$,(B
$B$G$-$^$9!%(B)

\subsection{$B%?%9%/$N<B9TJ}<0(B}
\begin{itemize}
\item $B%?%9%/$N<B9T$K$O!$%U%)%"%0%i%&%s%I$G$N<B9T$H%P%C%/%0%i%&%s%I$G$N<B9T(B
$B$,$"$j$^$9!%(B
\item $B%?%9%/$K$OI8=`F~NO!$I8=`=PNO!$I8=`%a%C%;!<%8=PNO$,$"$j!$%G%U%)(B
$B%k%H$G%7%'%k%&%$%s%I%&$,;XDj$5$l$F$$$^$9$,!$I,MW$K1~$8$F$3$l$r%U%!%$%k(B
$B$^$?$O?7$7$$%&%$%s%I%&$KJQ99$G$-$^$9!%(B
\item $B%Q%$%W(B{\tt "|"} $B$rMxMQ$7$FJ#?t$N%?%9%/$r7k9g$G$-$^$9!%%Q%$%W$K$h$C(B
$B$F7k9g$5$l$?%?%9%/$r%8%g%V$H8F$S$^$9!%(B
\end{itemize}

\subsection{$B%?%9%/$N<B9TNc(B}
\begin{itemize}
\item $B%U%)%"%0%i%&%s%I$G$N%j%9%J$N<B9T(B\\
{\tt Shell> listener}
\item $B%P%C%/%0%i%&%s%I$G$N%j%9%J$N<B9T(B\\
{\tt Shell> listener \&}
\item $BJ#?t$N%?%9%/$NEjF~(B\\
{\tt Shell> listener \& listener \& compiler}
\item $B%f!<%6Dj5A$N(B KL1 $B%W%m%0%i%`$N<B9T(B\\
{\tt Shell> sample6:demo}
\item $BI8=`F~NO$r%U%!%$%k$K;XDj$7$?%3%^%s%I$N<B9T(B\\
{\tt Shell> cat <= file("me:sample1.kl1")}\\
$B$3$l$G!$%U%!%$%k$NFbMF$rI=<($7$^$9!%(B( $B$?$@$7!$(B{\tt cat} $B$O6uGr9T$r%U%!(B
$B%$%k$N=*N;$H$_$J$7$^$9!%(B)
\item $BI8=`=PNO$r%U%!%$%k$K;XDj$7$?%3%^%s%I$N<B9T(B\\
{\tt Shell> cat => file(\outarg "file.new")}\\
$B%-!<F~NO$r%U%!%$%k$K=PNO$7$^$9(B( {\tt return} $B%-!<$G=*N;$7$^$9(B)$B!%(B\\
$B%U%!%$%kL>$NA0$K$"$k(B {\tt \outarg }$B$O(B write $B%b!<%I$N;XDj$G$9!%$3$l$r>J(B
$BN,$9$k$H(B append $B%b!<%I$K$J$j$^$9!%(B
\item $BI8=`F~NO$r%&%$%s%I%&$K;XDj$7!$I8=`=PNO$r%U%!%$%k$K;XDj$7$?%3%^%s(B
$B%I$N<B9T(B\\
{\tt Shell> cat <= window("window name") => file(\outarg "file.new")}
\item $BI8=`%a%C%;!<%8=PNO$r%U%!%$%k$K;XDj$7$?<B9T(B\\
{\tt Shell> compile(["sample1","sample2","sample3"]) ->
file(\outarg "compile.log")}\\
$B%P%C%A%3%s%Q%$%k(B( $B!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B 7.2.4 $B;2>H(B )$B$r<B(B
$B9T$7$^$9!%(B
\item $B%Q%$%W$NMxMQ(B\\
{\tt Shell> grep(":-") <= file("sample1.kl1") | lc}\\
$B%U%!%$%kCf$KJ8;zNs(B {\tt ":-" } $B$r4^$`9T$r<h$j=P$7!$$=$N?t$r?t$($^$9!%(B
\end{itemize}

\section{$B%8%g%V$N4IM}(B}
$B%7%'%k$K$O!$%8%g%V$N4IM}$r9T$J$&%3%^%s%I$H$7$F0J2<$N$b$N$,$"$j$^$9!%(B
\begin{itemize}
\item Control-C : $B%U%)%"%0%i%&%s%I$N%8%g%V$r%P%C%/%0%i%&%s%I$K0\$7$^$9!%(B
\begin{verbatim}
        Shell> compile
        COMPILE> ^C
        Shell>
\end{verbatim}
\item status : $B5/F0Cf$NA4%8%g%V$N>pJs$rI=<($7$^$9!%(B
\begin{verbatim}
        Shell> status
               1 --> running compile
\end{verbatim}
\item stop JobNo : JobNo $B$G;XDj$7$?%8%g%V$rDd;_$7$^$9!%(B\\
{\tt Shell> stop 1}
\item fore JobNo : JobNo $B$G;XDj$7$?%8%g%V$r%U%)%"%0%i%&%s%I$K0\$7!$$=(B
$B$N%8%g%V$,;_$^$C$F$$$?>l9g$K$O:F3+$7$^$9!%(B\\
{\tt Shell> fore 1}
\item back JobNo : JobNo $B$G;XDj$7$?%8%g%V$r%P%C%/%0%i%&%s%I$K0\$7!$$=(B
$B$N%8%g%V$,;_$^$C$F$$$?>l9g$K$O:F3+$7$^$9!%(B\\
{\tt Shell> back 1}
\item kill JobNo : JobNo $B$G;XDj$7$?%8%g%V$r=*N;$7$^$9!%(B\\
{\tt Shell> kill 1}
\item kill all : $BA4$F$N%8%g%V$r=*N;$7$^$9!%(B
\end{itemize}

\section{$B%7%'%k!&%f!<%F%#%j%F%#%W%m%0%i%`(B}
$B%7%'%k!&%f!<%F%#%j%F%#%W%m%0%i%`$O%7%'%k$+$i$N5/F0$rA0Ds$H$7$F:n@.$9$k%W(B
$B%m%0%i%`$G$9(B.  $B%W%m%0%i%`$N<B9T$r3+;O$9$k=R8l$NL>A0$r(B{\tt go} $B$KE}0l$7!$$=(B
$B$N%b%8%e!<%kL>$r%3%^%s%I$H$7$FF~NO$9$k$3$H$K$h$C$F5/F0$7$^$9!%(B

$B%f!<%6$O3F<+$N%7%'%k%f!<%F%#%j%F%#%W%m%0%i%`$K$h$C$F!$?7$?$J%7%'%k%3(B
$B%^%s%I$r:n$k$3$H$,$G$-$^$9!%(B( $B!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}, 8.3$B;2(B
$B>H(B )\\
$BNc$($P!$(BShell$B%f!<%F%#%j%F%#$N0l$D$G$"$k(B Echo $B%W%m%0%i%`$O<!$N$h$&$K5-=R$5(B
$B$l$F$$$^$9!%(B
\begin{verbatim}
        :- with_macro pimos.
        :- module echo.
        :- public go/1.

        go(Arg):- true|
                shoen:raise(pimos_tag#shell,get_std_out,Out),
                Out = [putt(Arg),nl,flush(_)].
\end{verbatim}
$B<B9TNc(B
\begin{verbatim}
        Shell> echo([a,b,c])
        [a,b,c]
        Shell> echo("a b c")
        "a b c"
\end{verbatim}

\chapter{$B%j%9%J(B}
\label{chap:Listener}
$BBh(B \ref{chap:run} $B>O$G<($7$?$h$&$K!$%j%9%J$K$O%H%l!<%9!$%$%s%9%Z%/%?$J$I(B
$B$N%G%P%C%0$N$?$a$N5!G=!$%G%C%I%m%C%/8!=P5!G=!$JQ?t%W!<%k$J$I$N5!G=$,$"(B
$B$j$^$9!%$3$N>O$G$O!$$=$NB>$N%j%9%J$N5!G=$N$&$A!$<g$J$b$N$K$D$$$F4JC1$K(B
$B@bL@$7$^$9!%(B

\section{$B%3%^%s%I(B}
\begin{itemize}
\item $B%j%9%J$N=*N;(B\\
{\tt ?- exit.}
\item $B8x3+=R8l$N8F$S$@$7(B
\begin{quote}
{\tt ?- }"$B%b%8%e!<%kL>(B":"$B%4!<%k(B".
\end{quote}
\item $B6I=j=R8l$N8F$S$@$7(B\\
$B%W%m%0%i%`Cf$G!$8x3+=R8l@k8@(B( public $B@k8@(B )$B$r$7$F$$$J$$=R8l$b<!$N$h$&(B
$B$K$7$F8F$S=P$9$3$H$,$G$-$^$9!%(B
\begin{quote}
{\tt ?- }"$B%b%8%e!<%kL>(B"::"$B%4!<%k(B".
\end{quote}
$BNc(B
\begin{quote}
{\tt ?- sample9::fork(100,32,0).}
\end{quote}
\item $BAH$_9~$_=R8l$N8F$S=P$7(B\\
KL1$B$N%\%G%#It$G<B9T2DG=$JAH$_9~$_=R8l$b8F$S=P$9$3$H$,2DG=$G$9!%(B\\
$BNc(B
\begin{quote}
{\tt ?- current\_processor(PE,X,Y), PEs := X*Y.}
\end{quote}
\item $B%X%k%W(B
\begin{quote}
{\tt ?- help.}\\
{\tt ?- help all.}\\
{\tt ?- help basic.}\\
$B$J$I!%(B
\end{quote}
\item {\tt statistics } $B%3%^%s%I(B ( {\tt st} $B$G$b$h$$(B )\\
$B%4!<%k$N>CHq$7$?;q8;NL(B( $B%j%@%/%7%g%s?t(B )$B$H!$<B9T;~4V$rI=<($9$k%b!<%I$r(B
ON $B$K$7$^$9!%(B( $B5U$O(B {\tt nostatistics} $B$^$?$O(B {\tt nst} )
\item $B%G%U%)%k%H%b%8%e!<%k$N@_Dj(B
\begin{quote}
{\tt ?- default\_module} "$B%b%8%e!<%kL>(B".
\end{quote}
$B$K$h$C$F!$%b%8%e!<%kL>$N%G%U%)%k%H$r@_Dj$9$k$3$H$,$G$-$^$9!%%G%U%)%k%H(B
$B$H$7$F;XDj$5$l$?%b%8%e!<%kCf$N%4!<%k$O!$%4!<%kL>$N$_$G8F$S=P$9$3$H$,$G(B
$B$-$^$9!%(B\\
$BNc(B
\begin{quote}
{\tt ?- default\_module sample9.}
\end{quote}
$B8x3+=R8l$N8F$S$@$7!%(B
\begin{quote}
{\tt ?- distribute(10).}
\end{quote}
$B6I=j=R8l$N8F$S$@$7!%(B
\begin{quote}
{\tt ?- :fork(10,8,0).}
\end{quote}
\item $B$=$NB>$N%3%^%s%I(B\\
$B3F%3%^%s%I$N>\:Y!$5Z$S$=$NB>$N%3%^%s%I$K$D$$$F$O!V(BPIMOS $B%^%K%e%"%k!W(B
\cite{PIMOS}$B$N(B10.5$B$r;2>H$7$F2<$5$$!%(B
\end{itemize}

\section{$B<B9T$NCfCG(B}
$B%j%9%J$G<B9TCf$N%W%m%0%i%`$O!$(B{\tt Control-C}( $B%"%F%s%7%g%s%-!<(B )$B$NF~(B
$BNO$K$h$C$FCfCG$9$k$3$H$,$G$-$^$9!%<B9T$rCfCG$7$?>uBV$G!$<!$N%3%^%s%I$,(B
$B;HMQ$G$-$^$9!%(B
\begin{itemize}
\item $<cr>$ : $B<B9T$N7QB3(B
\item g : $B%,!<%Y%8%3%l%/%?$N5/F0$H<B9T$N7QB3(B
\item r : $B;q8;>CHqNL(B( reduction $B?t(B )$B$NI=<((B
\item s : $B%W%m%0%i%`(B( $B%?%9%/(B )$B$N<B9T>uBV$NI=<((B
\item @ : $B%W%m%0%i%`(B( $B%?%9%/(B )$B$N;q8;>uBV$NI=<((B
\item t : $B%H%l!<%9$r;XDj$7$?%4!<%k$N$&$A!$$^$@%j%G%e!<%9$5$l$F$$$J$$%4!<(B
$B%k$NI=<((B
\item k : $B%H%l!<%9Cf$K<B9T$rJ]N1$7$?%4!<%k$NI=<((B
\item a : $B<B9T$NJ|4~(B
\item b : $B<B9T$NCfCG(B({\tt exit.}$B$GI|5"(B )
\item h : $B%3%^%s%I$N0lMw(B
\end{itemize}

\section{$BI8=`F~=PNO(B}
$BI8=`F~=PNO$O%G%U%)%k%H$G%j%9%J%&%$%s%I%&$,@_Dj$5$l$F$$$^$9$,!$$3$l$r%U%!(B
$B%$%k$"$k$$$O?7$?$J%&%$%s%I%&$K;XDj$9$k$3$H$,$G$-$^$9!%(B\\
$BNc(B
\begin{itemize}
\item $BI8=`=PNO$r%U%!%$%k(B {\tt "demo.out"} $B$K;XDj(B
\begin{quote}
{\tt ?- sample6:demo => file(\outarg "demo.out").}
\end{quote}
\item $BI8=`F~NO$r?7$?$J%&%$%s%I%&$K;XDj(B
\begin{quote}
{\tt ?- sample6:demo <= window("any name").}
\end{quote}
\item $BI8=`%a%C%;!<%8=PNO$r%U%!%$%k(B{\tt "demo.mes"} $B$K;XDj(B
\begin{quote}
{\tt ?- sample6:demo -> file(\outarg "demo.mes").}
\end{quote}
\end{itemize}

\chapter{CAL}
\label{chap:CAL}
CAL $B$O(B KL1 $B%W%m%0%i%`$N%3%s%Q%$%k!&%"%;%s%V%k!&%j%s%/$r<B9T$7$F!$%^%k(B
$B%A(B PSI $B$N(B CSP $B$,%m!<%I$G$-$k%P%$%J%j$N%*%V%8%'%/%H%U%!%$%k(B({\tt*.kbn})
$B$r:n$k%7%9%F%`$G$9!%(BPIMOS $B$N%W%m%0%i%`$O$9$Y$F(B KL1 $B$G5-=R$5$l!$(BCAL $B$K(B
$B$h$C$F%3%s%Q%$%k$5$l$F$$$^$9!%$"$J$?$N(B KL1 $B%W%m%0%i%`$r(B CAL $B$G%3%s%Q%$(B
$B%k$7!$(BPIMOS $BK\BN$N%*%V%8%'%/%H$K%j%s%/$9$k$H!$(BPIMOS $B$rN)$A>e$2;~$K!$$=(B
$B$N%W%m%0%i%`$N<B9T$KI,MW$J>pJs$,(B CSP $B>e$K%m!<%I$5$l$^$9!%(B

\section{CAL$B$N5/F0(B}
\begin{enumerate}
\item $B%7%9%F%`%a%K%e!<$G(B"CAL"$B$rA*Br$7$^$9!%(B

\setlength{\unitlength}{1.1mm}
\begin{picture}(120,65)(-60,-30)
\small
\put(-60,22){\framebox(120,7)[l]{~~SYSTEM MENU}}
\put(-60,-22){\framebox(120,44){}}
\put(0,16){\makebox(0,0){Multi-PSI}}
\put(-4,5.5){\framebox(12,6){CAL}}
\put(0,.5){\makebox(0,0){(Pseudo)Multi-PSI Installer}}
\end{picture}

\item $B%a%K%e!<$rA*Br$9$k$H!$%^%&%9$,%&%$%s%I%&;XDj$N>uBV$KJQ$o$j$^$9!%(B
( SIMPOS $B$NN)$A>e$28e!$:G=i$K(BCAL$B$r5/F0$9$k:]$K$O$7$P$i$/;~4V$,$+$+$j$^(B
$B$9!%(B ) $B$=$3$G!$%\%?%s$r%/%j%C%/$7$F%&%$%s%I%&$N0LCV$HBg$-$5$r7h$a$F2<(B
$B$5$$!%(B

\begin{center}
\begin{picture}(110,150)(-5,-5)
\put(0,0){\framebox(100,140){}}
\put(0,133){\line(1,0){100}}
\put(0,127){\line(1,0){100}}
\put(0,95){\line(1,0){100}}
\put(0,88){\line(1,0){100}}
\put(75,0){\line(0,1){95}}
\put(3,136){\makebox(0,0)[lb]{{\tt CAL manipulator}~~~~~\small{\tt
version 1.54 10-Jul-89 18:24:45}}}
\put(3,130){\makebox(0,0)[lb]{{\tt message window}}}
\put(3,90){\makebox(0,0)[lb]{{\tt File/Directory Menu}}}
\put(80,90){\makebox(0,0)[lb]{{\tt Command}}}

\put(3,82){\makebox(0,0)[lb]{{\tt PIMOS.DIR}}}
\put(3,76){\makebox(0,0)[lb]{{\tt SYSTEM.DIR}}}
\put(3,70){\makebox(0,0)[lb]{{\tt sample1.kl1}}}
\put(3,64){\makebox(0,0)[lb]{{\tt sample2.kl1}}}
\put(3,59){\makebox(0,0)[lb]{{\tt sample3.kl1}}}

\put(87,84){\makebox(0,0)[b]{{\tt Auto}}}
\put(87,78){\makebox(0,0)[b]{{\tt CoAs}}}
\put(87,72){\makebox(0,0)[b]{{\tt Comp}}}
\put(87,66){\makebox(0,0)[b]{{\tt Assm}}}
\put(87,60){\makebox(0,0)[b]{{\tt Link}}}
\put(87,54){\makebox(0,0)[b]{{\tt LMac}}}
\put(87,48){\makebox(0,0)[b]{{\tt Do}}}
\put(87,42){\makebox(0,0)[b]{{\tt Attr}}}
\put(87,36){\makebox(0,0)[b]{{\tt VarChk}}}
\put(87,30){\makebox(0,0)[b]{{\tt <other>}}}
\put(87,23){\makebox(0,0)[b]{{\tt <parent>}}}
\put(87,16){\makebox(0,0)[b]{{\tt <refresh>}}}
\put(87,9){\makebox(0,0)[b]{{\tt [shell]}}}
\put(87,2){\makebox(0,0)[b]{{\tt >Exit<}}}
\end{picture}
\end{center}

CAL $B$O<!$N$h$&$J5!G=$r;}$D;0$D$N%5%V%&%$%s%I%&$r;}$A$^$9!%(B
\begin{itemize}
\item message window\\
$B<B9T>uBV$NI=<(!$%3%^%s%I$NF~NO$r9T$&%&%$%s%I%&$G$9!%(B
\item File/Directory Menu\\
$B%+%l%s%H%G%#%l%/%H%j$K$"$k(B KL1$B%=!<%9%U%!%$%k(B({\tt *.kl1})$B!$%3%s%Q%$(B
$B%k!&%"%;%s%V%k<B9T8e$N%3!<%I%U%!%$%k(B({\tt *.rkp})$B!$%5%V%G%#%l%/%H%j$r(B
$BI=<($9$k%&%$%s%I%&$G$9!%%^%&%9$K$h$C$F%3%s%Q%$%k!&%"%;%s%V%k(B( {\tt
CoAs} )$B$r9T$J$&(B( $BJ#?t$N(B ) $B%U%!%$%k$r;XDj$7$^$9!%(B
\item Command\\
CAL $B$N%3%^%s%I$N%a%K%e!<$rI=<($9$k%&%$%s%I%&$G$9!%3F%3%^%s%I$O%^%&%9$G(B
$BA*Br$7$F<B9T$7$^$9!%(B
\end{itemize}
\end{enumerate}

\section{CAL $B$N;H$$J}(B}
CAL $B$K$h$k%3%s%Q%$%k!&%"%;%s%V%k!&%j%s%/$O<!$N$h$&$J<j=g$G9T$J$$$^$9!%(B
$B$^$:!$3F%W%m%0%i%`$r%3%s%Q%$%k!&%"%;%s%V%k$7$F%3!<%I%U%!%$%k(B({\tt
*.rkp})$B$r3F%U%!%$%kKh$K:n$j$^$9!%<!$K!$(BCAL $B$N%Q!<%7%c%k%j%s%/(B({\tt
plink})$B$N5!G=$K$h$C$F$=$l$i$r(B PIMOS $BK\BN$N%*%V%8%'%/%H(B
\begin{quote}
 {\tt pimos:pimos.kbn}
\end{quote}
$B$K%j%s%/$7$^$9!%(B

\begin{enumerate}
\item $B%G%#%l%/%H%j$NJQ99$,I,MW$J$H$-$O!$(B{\tt File/Directry Menu}$B$G!$(B
{\tt <other>}$B$rA*Br$7$^$9(B.  {\tt message window}$B$,F~NOBT$A$K$J$k$N$G(B
$B%G%#%l%/%H%jL>$rF~NO$7$^$9!%(B\\
$BNc(B
\begin{quote}
{\tt other>}\underline{\tt me:}
\end{quote}
\item $B%3%s%Q%$%k!&%"%;%s%V%k$7$?$$%U%!%$%k$r%^%&%9$GA*Br$7$^$9!%(B
{\tt File/Directory Menu} $B$NI=<($N0\F0$O!$%U%!%$%k%^%K%T%e%l!<%?$HF1MM(B
$B$NA`:n$G9T$J$$$^$9(B.  $B0lEY$KJ#?t8D$N%U%!%$%k$,A*Br$G$-$^$9(B.  
\item {\tt Command} $B%&%$%s%I%&$N(B{\tt CoAs} $B$rA*Br$7$F%3%s%Q%$%k!&%"%;(B
$B%s%V%k$r<B9T$7$^$9!%(B
\item {\tt message window} $B$K<B9T$NMM;R$,I=<($5$l$^$9!%@5>o$K%3%s%Q%$(B
$B%k$5$l$?>l9g!$<!$N$h$&$JI=<($K$J$j$^$9!%(B
\begin{quote}
\begin{verbatim}

**psi***::>sys>user>***>sample1.kl1.1
*Compile Start ....
furui/3,END
*Assemble Start ....
End.
*Output File Name
**psi***::>sys>user>***>sample1.rkp

*CoAs end !!
\end{verbatim}
\end{quote}

\item {\tt Command} $B%&%$%s%I%&$N(B{\tt Link}$B$rA*Br$7$^$9!%(B
\item PIMOS $BK\BN$N%*%V%8%'%/%H$KBP$7$F%Q!<%7%c%k%j%s%/$r<B9T$9$k$3$H$r(B
$B;XDj$7$^$9!%(B
\begin{quote}
{\tt >>} \underline{\tt plink pimos:pimos.kbn}     

~

{\tt ok.}

{\tt P>>}

\end{quote}
\item $B@h$[$I%3%s%Q%$%k$7$?%U%!%$%k(B( {\tt *.rkp} )$B$r0l$D$:$D%m!<%I$7$^(B
$B$9!%(B
\begin{quote}
{\tt P>>} \underline{\tt load ~sample1.rkp}

{\tt **psi***::>sys>user>***>sample1.rkp.1}

~{\tt StartPC:XXXXXXXX}

~~~{\tt EndPC:YYYYYYYY}

~

~~{\tt ok.}

{\tt **psi***::>sys>user>***>sample2.rkp.1}

........
\end{quote}
$B$3$3$G!$(B{\tt load *} $B$rF~NO$9$k$H!$%+%l%s%H%G%#%l%/%H%jCf$N(B{\tt *.rkp
}$B%U%!%$%k$,A4$F%m!<%I$5$l$^$9!%(B
\item {\tt psave} $B%3%^%s%I$G%Q!<%7%c%k%j%s%/$7$?FbMF$r%;!<%V$7$^$9!%(B

\begin{quote}
{\tt P>>} ~\underline{\tt psave}

{\tt Saving~....}

{\tt **>pimos.kbn}

{\tt **>pimos.ldb}

{\tt **>pimos.sym}

~

~~{\tt ok.}

{\tt >>}
\end{quote}
\item $B%j%s%+$r=*N;$7$^$9!%(B
\begin{quote}
{\tt >>}~\underline{\tt exit}
\end{quote}
\item KL1 $B$N%=!<%9%W%m%0%i%`$r=$@5$7$F:F$S%3%s%Q%$%k$7$J$*$9;~$O!$(B
{\tt Command} $B%&%$%s%I%&$+$i!$(B
\begin{quote}
 {\tt <refresh>}
\end{quote}
$B$rA*Br$7$F!$(B{\tt File/Directory Menu} $B$NI=<($r99?7$7$F2<$5$$!%(B
\end{enumerate}
CAL $B$r=*N;$9$k%3%^%s%I$O!$(B{\tt Command}$B%a%K%e!<$N(B {\tt >Exit< }$B$G$9!%(B

\begin{description}
\small
\item $BCm0U(B : $B%Q!<%7%c%k%j%s%/$O(B PIMOS $B$K%Q%C%A$rEv$F$k$3$H$K$h$C$F<B8=(B
$B$5$l$F$$$^$9!%=>$C$F%Q!<%7%c%k%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Dj$7$?8e!$(B{\tt Command} $B%a%K%e!<(B $B$N(B{\tt VarChk} $B$r%/%j%C%/$7$F$/$@$5$$(B.  
\vspace{5mm}

$B$5$i$K>\:Y$J(B CAL $B$N@bL@$O!V(BMulti-PSI/V2 $B%/%m%9%7%9%F%`(B(V2/CAL)$B$N;HMQK!!W(B
\cite{CAL}$B$r;2>H$7$F2<$5$$!%(B

\chapter{$B$=$NB>$N%f!<%F%#%j%F%#(B}
\label{chap:util}
$B$3$N>O$G$O!$(BPIMOS $B$N5!G=$N$&$ACN$C$F$$$k$HJXMx$J%W!<%k$H%?%$%^$K$D$$$F!$(B
$BNc$rMQ$$$F@bL@$7$^$9!%(B
\section{$B%W!<%k(B}
$B%W!<%k$OG$0U$N(BKL1$B%G!<%?$r3JG<$7(B, $B$^$?<h$j=P$9$3$H$N$G$-$k%G!<%?%Y!<%9(B
$B$G$9!%%W!<%k$K$O!$8!:wMQ$N%-!<$rIU$1$F%G!<%?$r3JG<$9$k%-!<IU$-$N%W!<(B
$B%k$H!$%G!<%?$r$=$N$^$^3JG<$9$k%-!<$J$7$N%W!<%k$,$"$j$^$9!%(B 
PIMOS$B$G$O!$%-!<IU$-!$%-!<$J$7$=$l$>$l$K!$MQES$K1~$8$F<!$N$h$&$J%W!<%k(B
$B$rDs6!$7$F$$$^$9!%(B
\begin{itemize}
\item $B%-!<$J$7(B : bag, stack, queue, sorted\_bag
\item $B%-!<IU$-(B : keyed\_bag, keyed\_set, keyed\_sorted\_bag,
keyed\_sorted\_set
\end{itemize}
$B$3$N$&$A!$Hf3SE*$h$/;H$&$H;W$o$l$k(B bag, keyed\_bug, keyed\_set $B$N;H$$J}(B
$B$rNc$rMQ$$$F@bL@$7$^$9!%%W!<%k$K$D$$$F$N>\:Y$O!$!V(BPIMOS $B%^%K%e%"%k!W(B
\cite{PIMOS}$B$N(B3.3$B$r;2>H$7$F2<$5$$!%(B
\begin{itemize}
\item Bag : $B%G!<%?$N3JG<$H<h$j=P$7$N5!G=$N$_$rM-$9$k:G$b4pK\E*$J%W!<%k(B
$B$G$9!%(B\\
$B8F$S=P$7J}(B
\begin{quote}
{\tt pool:bag(S)}
\end{quote}
$B%W!<%k$X$N%G!<%?$N<u$1EO$7$O!$$3$NJQ?t(B{\tt S} $B$K%a%C%;!<%8%W%m%H%3%k$r(B
$BAw$k$3$H$K$h$C$F9T$J$$$^$9!%(B
$B%a%C%;!<%8%W%m%H%3%k$N>\:Y$K$D$$$F$O!V(BPIMOS $B%^%K%e%"%k!W(B\cite{PIMOS}$B$N(B
3.3$B$r;2>H$7$F2<$5$$!%(B\\
$BNc(B
\begin{verbatim}
        ?- pool:bag(S),
           S=[empty(A), put("str"), put(atom), put({vect}),
              get(B), get_all(C), get_if_any(D)].
         A = yes
         B = {vect}
         C = [atom,"str"]
         D = {}
         S = [ ... ]
         yes.
\end{verbatim}
$B$3$3$G$O!$$^$:%W!<%k$,6u$+$I$&$+$rLd$$9g$o$;!$JQ?t(B {\tt A} $B$K(B {\tt
yes} $B$H$$$&Ez$rF@$^$9!%<!$K!$;0$D$N%G!<%?(B {\tt "str"}( $B%9%H%j%s%07?(B ),
{\tt atom}( $B%"%H%`7?(B ), {\tt \{vect\}}( $B%Y%/%?7?(B ) $B$r%W!<%k$K<}G<$7$^(B
$B$9!%$=$7$F!$<}G<$7$?%G!<%?$N$&$A$I$l$+0l$D$r<h$j=P$9$?$a$K!$(B{\tt
get(B)} $B$H$$$&%a%C%;!<%8$rAw$j!$(B{\tt B} $B$K(B {\tt \{vect\}} $B$H$$$&%G!<%?(B
$B$rF@$^$9!%%a%C%;!<%8(B {\tt get\_all(C)} $B$rAw$k$H!$JQ?t(B {\tt C} 
$B$K;D$j$NA4$F$NMWAG$N%j%9%H$,F@$i$l$^$9!%(B( $B0lHL$K!$0lEY<h$j=P$7$?%G!<%?(B
$B$O%W!<%k$+$i>C$($^$9!%(B)
$B:G8e$N%a%C%;!<%8(B{\tt get\_if\_any(D)} $B$KCm0U$7$F$/$@$5$$!%$3$l$O(B{\tt get( )} $B$H(B
$BF1MM$KMWAG$r(B1$B$D$H$j$@$9%a%C%;!<%8$G$9$,!$%W!<%k$,6u$N>l9g(B {\tt  get( )} 
$B$,<:GT(B( $B%W%m%0%i%`$,(B fail )$B$9$k$N$KBP$7(B, {\tt get\_if\_any( )} $B$O(B,
{\tt \{ \} } $B$rJV$7$^$9!%(B
\item Keyed Bag : $B%-!<IU$-$N%W!<%k!%%O%C%7%e%F!<%V%k$rMxMQ$7$F%G!<(B
$B%?$r8!:w$7$^$9!%(B\\
$B8F$S$@$7J}(B
\begin{quote}
{\tt pool:keyed\_bag(S)}
\end{quote}
$BNc(B
\begin{verbatim}
       ?- pool:keyed_bag(S),
          S=[empty(A), put("atom",atom), put(str,"str1"),
             put(str,"str2"), put({vect},v(1)),
             empty(str,B), get(str,C), get_if_any("atom",D),
             get_and_put({vect},E,v(100)), get_all(F) ]
        A = yes
        B = no
        C = "str2"
        D = {atom}
        E = {v(1)}
        F = {{{vect},v(100)},str("str1")}
        S = [ ... ]
        yes.
\end{verbatim}
$B$3$3$G$O!$$^$:%W!<%kA4BN$,6u$+$I$&$+$rLd$$9g$o$;!$(B{\tt yes} $B$rF@$^$9!%(B
$B<!$K!$(B{\tt "atom"}$B$H$$$&%-!<$KBP$7$F(B{\tt atom} $B$H$$$&%G!<%?!$(B{\tt str} 
$B$H$$$&%-!<$KBP$7$F(B {\tt "str1"}, {\tt "str2"} $B$H$$$&Fs$D$N%G!<%?!$$5$i(B
$B$K!$(B{\tt \{vect\}} $B$H$$$&%-!<$KBP$7$F(B{\tt v(1)} $B$H$$$&%G!<%?$r%W!<%k$K(B
$B<}G<$7$^$9!%$3$3$G!$(B{\tt str} $B$H$$$&%-!<$KBP$7$F!$%W!<%k$,6u$+$I$&$+$r(B
$BLd$$9g$o$;!$(B{\tt no} $B$H$$$&2sEz$rF@$?8e!$$=$N%-!<$KBP$7$F%G!<%?$r0l$D(B
$B<h$j=P$7$^$9!%<!$K!$:#EY$O(B{\tt "atom"}$B$H$$$&%-!<$KBP$7$F6u$+$I$&$+$rLd(B
$B$$9g$o$;$r9T$J$o$:$K!$D>@\(B{\tt get\_if\_any} $B$G%G!<%?$r<h$j=P$7$F$$$^(B
$B$9!%$=$N<!$N(B{\tt get\_and\_put} $B$O(B {\tt \{vect\}} $B$H$$$&%-!<$N%G!<%?$r0l(B
$B$D<h$j=P$7!$$=$l$r(B {\tt v(100)} $B$GCV$-49$($F$$$^$9!%:G8e$N(B {\tt
get\_all } $B$K$h$C$F!$%W!<%kCf$NA4$F$N%G!<%?$r%-!<$H6&$K<h$j=P$7$F$$$^(B
$B$9!%(B
\item Keyed Set : $B%-!<$N=EJ#$r5v$5$J$$%-!<IU$-$N%W!<%k!%(B
\begin{quote}
{\tt pool:keyed\_set(S)}
\end{quote}
$BNc(B
\begin{verbatim}
       ?- pool:keyed_set(S),
          S=[put(key,"str",A), put(key,atom,B), get(key,C)].
        A = {}
        B = {"str"}
        C = atom
        S = [ ... ]
        yes.
\end{verbatim}
{\tt keyed\_set} $B$G$O!$%a%C%;!<%8(B{\tt put }$B$K$h$C$F!$$"$k%-!<$KBP$7$F(B
$B2?$i$+$N%G!<%?$r3JG<$9$k:]!$$=$N%-!<$KBP$7$FJL$N%G!<%?$,$9$G$K<}G<$5$l(B
$B$F$$$k>l9g$O!$$=$N%G!<%?$,(B{\tt put} $B$NBh(B3$B0z?t$KJV$5$l$^$9!%(B
$B$3$NNc$G$O!$:G=i$N(B{\tt put} $B$N<B9T$N:]$K$O%-!<(B{\tt key} $B$KBP$9$k%G!<%?(B
$B$,B8:_$7$J$$$N$G!$JQ?t(B{\tt A} $B$K(B{\tt \{\}}$B$,JV$5$l!$<!$N(B{\tt put} $B$N<B(B
$B9T;~$K$O!$JQ?t(B{\tt  B} $B$K(B{\tt "str"} $B$,JV$5$l$F$$$^$9!%(B

\end{itemize}
\subsection{$B%W!<%k$rMxMQ$7$?%W%m%0%i%`$NNc(B}
$B0J2<$K<($9%W%m%0%i%`$O!$;XDj$7$?%U%!%$%k$N3F9T$r%W!<%k(B Keyed Bag $B$K<h(B
$B$j9~$s$@8e!$%f!<%6$N;XDj$7$?9T$rI=<($7$^$9!%$3$N%W%m%0%i%`$r%3%s%Q%$%k(B
$B$9$kA0$K!$Bh(B \ref{chap:program} $B>O$G<($7$?%b%8%e!<%k(B {\tt "file"} $B$r%3(B
$B%s%Q%$%k$7$F$*$$$F2<$5$$!%(B
\begin{verbatim}

        :- module sample10.
        :- public go/1.
        :- with_macro pimos.

        go(Name):- true|
                file:open(Name,r,[getl(L)|F],success),
                std_inter(IO)@priority($,-100),
                IO=[putt('Number of Lines = '),putt(NL),nl,
                    prompt("> "),gett(T)|IO1],
                pool:keyed_bag(Pool),
                read_file(L,F,P1,1,NL),
                display(T,IO1,P2),
                merge({P1,P2},Pool).

        std_inter(IO):- true|
                shoen:raise(pimos_tag#shell,get_std_inter,IO).

        read_file(-1,F,P,N,NL):- true|
                F=[],P=[],NL:=N-1.
        otherwise.
        read_file(L,F,P,N,NL):- true|
                P=[put(N,L)|P1],
                F=[getl(L1)|F1],
                N1 := N+1,
                read_file(L1,F1,P1,N1,NL).

        display(exit,IO,P):- true|
                IO=[],P=[].
        display(N,IO,P):- integer(N)|
                P=[get_if_any(N,L)|P0],
                ( L={St} -> 
                  P0=[put(N,St)|P1],
                  IO=[putt(N),putt(' : '),putl(St),
                      prompt("> "),gett(T)|IO1]
                ; otherwise
                ; true -> IO=[prompt("> "),gett(T)|IO1],
                              P1=P0 ),
                display(T,IO1,P1).
        otherwise.
        display(_,IO,P):- true|
                IO=[prompt("> "),gett(T)|IO1],
                display(T,IO1,P).

\end{verbatim}
$B<B9TNc(B
\begin{verbatim}

        ?- sample10:go("sample10.kl1").
        Number of Lines = 42
        > 5.
        5 : go(Name):- true|
        > 7.
        7 : std_inter(IO)@priority($,-100),
        > 1.
        1 : :- module sample10.
        > exit.
         yes.

\end{verbatim}

\section{$B%?%$%^(B}
$B%?%$%^$O%U%!%$%k$d%&%$%s%I%&$HF1MM!$(BPIMOS $B$NDs6!$9$k;q8;$N0l$D$G$9!%%?(B
$B%$%^$r;H$C$F(B, $B;~9o$rCN$k$3$H$,$G$-$^$9(B.  $B$^$?!$$3$l$K$h$C$F%W%m%0%i%`(B
$B$N=jMQ;~4V$rB,Dj$9$k$3$H$b2DG=$G$9!%(B

$B%?%$%^$rMxMQ$9$k$?$a$K!$<!$N$h$&$J%b%8%e!<%k$r:n$j$^$7$g$&!%(B
\begin{verbatim}

        :- module timer.
        :- public create/1.

        create(Timer):- true|
                shoen:raise(pimos_tag#task,
                        general_request,General_Request_Device),
                General_Request_Device=
                        [timer(normal(Timer_Request_Device,_,_))],
                Timer_Request_Device=
                        [create(normal(Timer,_,_))].

\end{verbatim}

$B$3$N%b%8%e!<%k$KBP$7$F!$(B
\begin{quote}
 {\tt ?- timer:create(Timer), Timer = [\ldots]. }
\end{quote}
$B$r<B9T$9$k$H!$%?%$%^%G%P%$%9$X$N%9%H%j!<%`$,(B {\tt Timer} $B$KF@$i$l$^$9!%(B
$B$3$N%9%H%j!<%`$K0J2<$N%a%C%;!<%8$rAw$k$3$H$K$h$C$F!$%?%$%^$N5!G=$rMxMQ(B
$B$G$-$^$9!%(B
\begin{itemize}
\item {\tt get\_count(\outarg  Result)}\\
0 $B;~(B 0 $BJ,$+$i8=:_$^$G$N7P2a;~4V$r%_%jICC10L$GJV$7$^$9!%(B
{\tt Result} $B$K$O!$(B{\tt normal(Count)}$B$,JV$j$^$9!%$3$3$G!$(B{\tt Count}
$B$,7P2a;~4V$G$9!%(B
\item {\tt on\_at(Count,\outarg  Result)}\\
$B%_%jICC10L$G;XDj$7$?;~9o$r(B{\tt Count} $B$KM?$($k$H!$(B{\tt Result} $B$K(B{\tt
normal(Now)} $B$rJV$7!$$=$N;~9o$,Mh$k$H(B{\tt Now} $B$,(B{\tt wake\_up}$B$K6qBN(B
$B2=$5$l$^$9!%(B
\item {\tt on\_after(Count,\outarg Result)}\\
$B%_%jICC10L$G;XDj$7$?;~4V$r(B{\tt Count} $B$KM?$($k$H!$(B{\tt Result} $B$K(B{\tt
normal(Now)} $B$rJV$7!$$=$N;~4V$r7P2a$9$k$H(B{\tt Now} $B$,(B{\tt wake\_up}$B$K6q(B
$BBN2=$5$l$^$9!%(B
\end{itemize}

\subsection{$B%?%$%^$rMxMQ$7$?%W%m%0%i%`$NNc(B}
$B$3$3$G$O!$%?%$%^$rMxMQ$7$?%W%m%0%i%`$NNc$H$7$F!$%"%i!<%`$N%W%m%0%i(B
$B%`$r<($7$^$9!%%?%$%^%G%P%$%9$N%9%H%j!<%`$K%a%C%;!<%8(B{\tt on\_at(Count,\outarg
Result)} $B$rAw$k$H!$JQ?t(B{\tt Result} $B$K$O(B {\tt normal(Now)} $B$H$$$&CM$,(B
$BJV$5$l!$JQ?t(B{\tt Now} $B$O;XDj$7$?;~9o$K$J$k$H(B{\tt wake\_up} $B$K6qBN2=$5$l(B
$B$^$9!%%"%i!<%`$O!$$3$NJQ?t$,6qBN2=$5$l$?;~$K!$%a%C%;!<%8$r=PNO$9$k%W%m%;(B
$B%9$K$h$C$F<B8=$5$l$F$$$^$9!%(B
\begin{verbatim}

        :- module alarm.
        :- public go/3.

        go(H,M,Mes):- 
                integer(H),integer(M), string(Mes,_,_)|
                Time := ( H*3600 + M*60 )*1000,
                timer:create( [on_at(Time,normal(Now))] ),
                alarm( Now, Mes ).
        alarm( wake_up, Mes ):- true|
                shoen:raise( pimos_tag#shell, get_std_mes, Stream),
                Stream=[ putl(Mes) ].

\end{verbatim}
$B$3$N%W%m%0%i%`$r%3%s%Q%$%k$9$kA0$K!$>e$K<($7$?%b%8%e!<%k(B {\tt timer} 
$B$r%3%s%Q%$%k$7$F$*$$$F2<$5$$!%$3$N%W%m%0%i%`$O%7%'%k!&%f!<%F%#%j%F%#$H(B
$B$7$F;HMQ$G$-$^$9(B( $BBh(B \ref{chap:Shell} $B>O;2>H(B )$B!%(B\\
$B<B9TNc(B
\begin{verbatim}

        Shell> alarm(17,30,"### Time is up. ###")&
        Shell> ......

        Shell> (Shell Command or <cr> )
        ### Time is up. ###

\end{verbatim}

$B;XDj$7$?;~4V$,$/$k$H(B, {\tt \#\#\# Time is up. \#\#\#} $B$N%a%C%;!<%8$,I=<($5$l(B
$B$^$9!%(B

\begin{thebibliography}{99}
\bibitem{INSTALL}
(Pseudo)$B%^%k%A(BPSI$B%7%9%F%`4IM}%^%K%e%"%k(B
\bibitem{CSP}
$B%^%k%A(BPSI/V2$B%3%s%=!<%k%7%9%F%`(B(CSP)$BA`:n@bL@=q(B
\bibitem{PIMOS}
PIMOS $B%^%K%e%"%k(B ($BBh(B 1.5 $BHG(B)
\bibitem{CAL}
Multi-PSI/V2 $B%/%m%9%7%9%F%`(B(V2/CAL)$B$N;HMQK!(B
\bibitem{KL1}
KL1 $B%W%m%0%i%_%s%0(B $BF~LgJT(B/$B=i5iJT(B/$BCf5iJT(B
\bibitem{SYSTEM}
$B>.7?2=(BPSI/SIMPOS$B%7%9%F%`4IM}@bL@=q(B
\bibitem{SIMPOS}
$B>.7?2=(B PSI/SIMPOS $BA`:n@bL@=q(B (1),(2)
\end{thebibliography}
\end{document}

