Annotation of OpenXM/src/asir-doc/parts/asir.texi, Revision 1.1
1.1 ! noro 1: @node $B%f!<%68@8l(B Asir,,, Top
! 2: @chapter $B%f!<%68@8l(B Asir
! 3:
! 4: @noindent
! 5: @b{Asir} $B$NAH$_9~$_H!?t$O(B, $B0x?tJ,2r(B, GCD $B$J$I$N7W;;$r9T$&$b$N(B, $B%U%!(B
! 6: $B%$%kF~=PNO$r9T$&$b$N(B, $B$"$k$$$O?t<0$N0lIt$r<h$j=P$9$b$N$J$I$5$^$6$^$J$b$N(B
! 7: $B$,MQ0U$5$l$F$$$k$,(B, $B%f!<%6$,<B:]$K9T$$$?$$$3$H$r<B9T$5$;$k$?$a$K$O0l(B
! 8: $BHL$K$O%f!<%68@8l$K$h$k%W%m%0%i%`$r=q$/I,MW$,$"$k(B. $B%f!<%68@8l$b(B
! 9: @b{Asir} $B$H8F$P$l$k(B. $B0J2<$G$O(B, $B%f!<%68@8l$NJ8K!5,B'$*$h$S<B:]$N%f!<(B
! 10: $B%68@8l%W%m%0%i%`$rNc$H$7$?%W%m%0%i%`$N=q$-J}$K$D$$$F=R$Y$k(B.
! 11:
! 12: @menu
! 13: * $BJ8K!(B (C $B8@8l$H$N0c$$(B)::
! 14: * $B%f!<%6Dj5AH!?t$N=q$-J}(B::
! 15: @end menu
! 16:
! 17:
! 18: @node $BJ8K!(B (C $B8@8l$H$N0c$$(B),,, $B%f!<%68@8l(B Asir
! 19: @section $BJ8K!(B (C $B8@8l$H$N0c$$(B)
! 20:
! 21: @noindent
! 22: @b{Asir} $B$NJ8K!$O(B C $B8@8l$K=`5r$7$F$$$k(B.
! 23: $B$*$b$JAj0cE@$O<!$NDL$j$G$"$k(B. $B0J2<$G(B, $BJQ?t$H$O(B @b{Asir} $B$K$*$1$k(B
! 24: $B%W%m%0%i%`MQ$NJQ?t(B, $B$9$J$o$ABgJ8;z$G;O$^$kJ8;zNs$r0UL#$9$k$3$H$H$9$k(B.
! 25:
! 26: @itemize @bullet
! 27: @item
! 28: $BJQ?t$N7?$,$J$$(B.
! 29:
! 30: $B4{$K@bL@$7$?$H$*$j(B, @b{Asir} $B$G07$o$l$kBP>]<+?H$OA4$F2?$i$+$N7?(B
! 31: $B$r;}$C$F$$$k(B. $B$7$+$7(B, $B%W%m%0%i%`JQ?t<+BN$O(B, $B$I$N$h$&$JBP>]$G$b(B
! 32: $BBeF~$G$-$k$H$$$&0UL#$G7?$,$J$$$N$G$"$k(B.
! 33:
! 34: @example
! 35: [0] A = 1;
! 36: 1
! 37: [1] type(A);
! 38: 1
! 39: [2] A = [1,2,3];
! 40: [1,2,3]
! 41: [3] type(A);
! 42: 4
! 43: @end example
! 44:
! 45: @item
! 46: $BH!?tFb$NJQ?t$O(B, $B%G%U%)%k%H$G$O2>0z?t$r$3$a$F$9$Y$F6I=jJQ?t(B.
! 47: $B$?$@$7(B, @code{extern} $B@k8@$5$l$?JQ?t$O(B, $B%H%C%W%l%Y%k$K$*$1$kBg0hJQ?t$H$J$k(B.
! 48:
! 49: $B$9$J$o$A(B, $BJQ?t$N%9%3!<%W$OBg0hJQ?t$H6I=jJQ?t$N(B 2 $B<oN`$KC1=c2=$5$l$F$$$k(B.
! 50: $B%H%C%W%l%Y%k(B, $B$9$J$o$A%W%m%s%W%H$KBP$7$FF~NO$5$l$?JQ?t$OA4$FBg0hJQ?t(B
! 51: $B$H$7$FEPO?$5$l$k(B. $B$^$?H!?tFb$G$O<!$N$$$:$l$+$H$J$k(B.
! 52:
! 53: @enumerate
! 54: @item
! 55: $BH!?t$,Dj5A$5$l$k%U%!%$%k$K$*$$$F(B, $B$=$NH!?tDj5A0JA0$K(B, $B$"$k(B
! 56: $BJQ?t$,(B @code{extern} $B@k8@$5$l$F$$$k>l9g(B, $BH!?tFb$N$=$NJQ?t$bBg0hJQ?t(B
! 57: $B$H$7$F07$o$l$k(B.
! 58:
! 59: @item
! 60: @code{extern} $B@k8@$5$l$F$$$J$$JQ?t$O$=$NH!?t$K6I=jE*$H$J$k(B.
! 61: @end enumerate
! 62:
! 63: @example
! 64: % cat afo
! 65: def afo() @{ return A;@}
! 66: extern A$
! 67: def bfo() @{ return A;@}
! 68: end$
! 69: % asir
! 70: [0] load("afo")$
! 71: [5] A = 1;
! 72: 1
! 73: [6] afo();
! 74: 0
! 75: [7] bfo();
! 76: 1
! 77: @end example
! 78:
! 79: @item
! 80: $B%W%m%0%i%`JQ?t$OBgJ8;z$G;O$^$j(B, $BITDj85(B, $BH!?t$O>.J8;z$G;O$^$k(B.
! 81:
! 82: $B$3$NE@$O(B, $B4{B8$N?t<0=hM}%7%9%F%`$N$[$H$s$I$H0[$J$kE@$G$"$k(B. @b{Asir}
! 83: $B$,$3$N;EMM$r:NMQ$7$?$N$O(B, $B%f!<%6$,ITDj85$N$D$b$j$G;HMQ$7$?JQ?t$K(B
! 84: $B$J$s$i$+$NCM$,BeF~$5$l$F$$$?>l9g$K:.Mp$r>7$/(B, $B$H$$$&(B, $B4{B8$N(B
! 85: $B%7%9%F%`$K$"$j$,$A$J>u67$rHr$1$k$?$a$G$"$k(B.
! 86:
! 87: @item
! 88: @code{switch} $BJ8(B, @code{goto} $B$,$J$$(B.
! 89:
! 90: @code{goto} $B$,$J$$$?$a(B, $BB?=E%k!<%W$r0lEY$KH4$1$k$N$,$d$dJ#;($K$J$k>l9g$,$"$k(B.
! 91:
! 92: @item
! 93: $B%3%s%^<0$O(B, @code{for (A;B;C)} $B$^$?$O(B, @code{while(A)} $B$N(B @code{A}, @code{B}, @code{C} $B$K$N$_;H$&$3$H$,$G$-$k(B.
! 94:
! 95: $B$3$l$O(B, $B%j%9%H$r@5<0$J%*%V%8%'%/%H$H$7$F2C$($?$3$H$K$h$k(B.
! 96:
! 97: @end itemize
! 98:
! 99: @noindent
! 100: $B0J>e$O@)8B$G$"$k$,(B, $B3HD%$H$7$F$O<!$NE@$,5s$2$i$l$k(B.
! 101:
! 102: @itemize @bullet
! 103: @item
! 104: $BM-M}<0$KBP$9$k7W;;$r(B, $BDL>o$N(B C $B$K$*$1$k7W;;$HF1MM$K$G$-$k(B.
! 105:
! 106: @item
! 107: $B%j%9%H$,07$($k(B.
! 108:
! 109: $B9=B$BN$rMQ$$$k$^$G$b$J$$MWAG$N=89gBN$r(B, $B%j%9%H$GI=$9$3$H$,$G$-(B,
! 110: C $B$GD>@\=q$/>l9g$KHf3S$7$F%W%m%0%i%`$,C;$/(B, $BFI$_$d$9$/=q$1$k(B.
! 111: @end itemize
! 112:
! 113: @node $B%f!<%6Dj5AH!?t$N=q$-J}(B,,, $B%f!<%68@8l(B Asir
! 114: @section $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 115:
! 116: @menu
! 117: * $B%f!<%6Dj5AH!?t(B::
! 118: * $BJQ?t$*$h$SITDj85(B::
! 119: * $B0z?t(B::
! 120: * $B%3%a%s%H(B::
! 121: * $BJ8(B::
! 122: * return $BJ8(B::
! 123: * if $BJ8(B::
! 124: * $B%k!<%W(B break return continue::
! 125: * $B$5$^$6$^$J<0(B::
! 126: * $B%W%j%W%m%;%C%5(B::
! 127: @end menu
! 128:
! 129: @node $B%f!<%6Dj5AH!?t(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 130: @subsection $B%f!<%6Dj5AH!?t(B
! 131:
! 132: @noindent
! 133: $B%f!<%6$K$h$kH!?t$NDj5A$O(B @samp{def} $BJ8$G9T$&(B. $BJ8K!%(%i!<$OFI$_9~$_;~$K(B
! 134: $B$"$kDxEY%A%'%C%/$5$l(B, $B$*$*$h$=$N>l=j$,I=<($5$l$k(B.
! 135: $B4{$K(B($B0z?t$N8D?t$K4X78$J$/(B)$BF1L>$NH!?t$,Dj5A$5$l$F$$$k>l9g$K$O(B,
! 136: $B$=$NH!?t$O:FDj5A$5$l$k(B. @code{ctrl()} $BH!?t$K$h$j(B @code{verbose} $B%U%i%0(B
! 137: $B$,(B on $B$K$J$C$F$$$k>l9g(B,
! 138:
! 139: @example
! 140: afo() redefined.
! 141: @end example
! 142:
! 143: @noindent
! 144: $B$H$$$&%a%C%;!<%8$,I=<($5$l$k(B. $B$"$kH!?t$NDj5A$K$*$$$F(B, $B$^$@L$Dj5A$NH!?t(B
! 145: $B$r8F$S=P$7$F$$$F$b(B, $BDj5A;~$K$O%(%i!<$K$J$i$J$$(B. $B<B9T;~$KL$Dj5A$NH!?t(B
! 146: $B$r8F$S=P$=$&$H$7$?>l9g$K%(%i!<$H$J$k(B.
! 147:
! 148: @example
! 149: @tex
! 150: /* $X!$ */
! 151: @end tex
! 152:
! 153: def f(X) @{
! 154: if ( !X )
! 155: return 1;
! 156: else
! 157: return X * f(X-1);
! 158: @}
! 159:
! 160: @tex
! 161: /* ${_i}C_j ( 0 \le i \le N, 0 \le j \le i )$ */
! 162: @end tex
! 163:
! 164: def c(N)
! 165: @{
! 166: A = newvect(N+1); A[0] = B = newvect(1); B[0] = 1;
! 167: for ( K = 1; K <= N; K++ ) @{
! 168: A[K] = B = newvect(K+1); B[0] = B[K] = 1;
! 169: for ( P = A[K-1], J = 1; J < K; J++ )
! 170: B[J] = P[J-1]+P[J];
! 171: @}
! 172: return A;
! 173: @}
! 174: @end example
! 175:
! 176: @noindent
! 177: 2 $B$DL\$NNc$G$O(B, $BD9$5(B @code{N+1} $B$N%Y%/%H%k(B (@code{A}$B$H$9$k(B) $B$,JV$5$l$k(B.
! 178: @code{A[I]} $B$OD9$5(B @code{I+1} $B$NG[Ns$G$"$j(B, $B$=$N$=$l$>$l$NMWAG$,(B
! 179: @iftex
! 180: @tex
! 181: ${_I}C_J$
! 182: @end tex
! 183: @end iftex
! 184: @ifinfo
! 185: ICJ
! 186: @end ifinfo
! 187: $B$rMWAG$H$9$kG[Ns$G$"$k(B.
! 188:
! 189: @noindent
! 190: $B0J2<$G$O(B, C $B$K$h$k%W%m%0%i%_%s%0$N7P83$,$J$$?M$N$?$a$K(B, @b{Asir} $B8@8l(B
! 191: $B$K$h$k%W%m%0%i%`$N=q$-J}$r2r@b$9$k(B.
! 192:
! 193: @node $BJQ?t$*$h$SITDj85(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 194: @subsection $BJQ?t$*$h$SITDj85(B
! 195:
! 196: @noindent
! 197: $B4{$K=R$Y$?DL$j(B, @b{Asir} $B$K$*$$$F$O%W%m%0%i%`JQ?t$HITDj85$rL@3N$K(B
! 198: $B6hJL$7$F$$$k(B.
! 199:
! 200: @table @b
! 201: @item $BJQ?t(B
! 202: $BBgJ8;z$G;O$^$j(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B
! 203:
! 204: $BJQ?t$"$k$$$O%W%m%0%i%`JQ?t$H$O(B, @b{Asir} $B$N$5$^$6$^$J7?$NFbIt7A<0$r(B
! 205: $B3JG<$9$k$?$a$NH"$G$"$j(B, $B3JG<$5$l$?FbIt7A<0$,(B, $B$3$NJQ?t$NCM$G$"$k(B. $BJQ(B
! 206: $B?t$,<0$NMWAG$H$7$FI>2A$5$l$k;~$O(B, $B$=$3$K<}$a$i$l$?CM$KCV$-49$($i$l$k(B.
! 207: $B$9$J$o$A(B, $BFbIt7A<0$NCf$K$O%W%m%0%i%`JQ?t$O8=$l$J$$(B. $BJQ?t$OA4$F(B 0 $B$G(B
! 208: $B=i4|2=$5$l$F$$$k(B.
! 209:
! 210: @example
! 211: [0] X^2+X+1;
! 212: 1
! 213: [1] X=2;
! 214: 2
! 215: [2] X^2+X+1;
! 216: 7
! 217: @end example
! 218:
! 219: @item $BITDj85(B
! 220: $B>.J8;z$G;O$^$j(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B
! 221:
! 222: $BITDj85$H$O(B, $BB?9`<04D$r9=@.$9$k:]$KE:2C$5$l$kJQ?t$r$$$&(B. @b{Asir} $B$K(B
! 223: $B$*$$$F$O(B, $BITDj85$OCM$r$b$?$J$$D61[E*$J85$G$"$j(B, $BITDj85$X$NCM$NBeF~$O(B
! 224: $B5v$5$l$J$$(B.
! 225:
! 226: @example
! 227: [3] X=x;
! 228: x
! 229: [4] X^2+X+1;
! 230: x^2+x+1
! 231: @end example
! 232: @end table
! 233:
! 234: @node $B0z?t(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 235: @subsection $B0z?t(B
! 236:
! 237: @example
! 238: def sum(N) @{
! 239: for ( I = 1, S = 0; I <= N; I++ )
! 240: S += I;
! 241: return S;
! 242: @}
! 243: @end example
! 244:
! 245: @noindent
! 246: $B$3$l$O(B, 1 $B$+$i(B @code{N} $B$^$G$N<+A3?t$NOB$r5a$a$kH!?t(B @code{sum()} $B$N(B
! 247: $BDj5A$G$"$k(B. $B$3$NNc$K$*$1$k(B @code{sum(N)} $B$N(B @code{N} $B$,0z?t$G$"$k(B.
! 248: $B$3$NNc$O(B, 1 $B0z?tH!?t$NNc$G$"$k$,(B, $B0lHL$K0z?t$N8D?t$OG$0U$G$"$j(B,
! 249: $BI,MW$J$@$1$N8D?t$r(B @samp{,} $B$G6h@Z$C$F;XDj$9$k$3$H$,$G$-$k(B. $B0z?t$O(B
! 250: $BCM$,EO$5$l$k(B. $B$9$J$o$A(B, $B0z?t$r<u$1$H$C$?B&$,(B, $B$=$N0z?t$NCM$rJQ99$7$F(B
! 251: $B$b(B, $BEO$7$?B&$NJQ?t$OJQ2=$7$J$$(B. $B$?$@$7(B, $BNc30$,$"$k(B. $B$=$l$O(B, $B%Y%/%H%k(B,
! 252: $B9TNs$r0z?t$KEO$7$?>l9g$G$"$k(B. $B$3$N>l9g$b(B, $BEO$5$l$?JQ?t$=$N$b$N$r=q$-(B
! 253: $BBX$($k$3$H$O(B, $B$=$NH!?t$K6I=jE*$JA`:n$G$"$k$,(B, $BMWAG$r=q$-49$($?>l9g(B,
! 254: $B$=$l$O(B, $B8F$S=P$7B&$N%Y%/%H%k(B, $B9TNs$NMWAG$r=q$-49$($k$3$H$K$J$k(B.
! 255:
! 256: @example
! 257: def clear_vector(M) @{
! 258: /* M is expected to be a vector */
! 259: L = size(M)[0];
! 260: for ( I = 0; I < L; I++ )
! 261: M[I] = 0;
! 262: @}
! 263: @end example
! 264:
! 265: @noindent
! 266: $B$3$NH!?t$O(B, $B0z?t$N%Y%/%H%k$r(B 0 $B%Y%/%H%k$K=i4|2=$9$k$?$a$NH!?t$G$"$k(B.
! 267: $B$^$?(B, $B%Y%/%H%k$r0z?t$KEO$9$3$H$K$h$j(B, $BJ#?t$N7k2L$r0z?t$N%Y%/%H%k$K(B
! 268: $B<}G<$7$FJV$9$3$H$,$G$-$k(B. $B<B:]$K$O(B, $B$3$N$h$&$J>l9g$K$O(B, $B7k2L$r%j%9%H(B
! 269: $B$K$7$FJV$9$3$H$b$G$-$k(B. $B>u67$K1~$8$F;H$$$o$1$9$k$3$H$,K>$^$7$$(B.
! 270:
! 271: @node $B%3%a%s%H(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 272: @subsection $B%3%a%s%H(B
! 273:
! 274: @noindent
! 275: C $B$HF1MM(B @samp{/*} $B$H(B @samp{*/} $B$G0O$^$l$?ItJ,$O%3%a%s%H$H$7$F07$o$l$k(B.
! 276:
! 277: @example
! 278: /*
! 279: * This is a comment.
! 280: */
! 281:
! 282: def afo(X) @{
! 283: @end example
! 284:
! 285: @noindent
! 286: $B%3%a%s%H$OJ#?t9T$KEO$C$F$b9=$o$J$$$,(B, $BF~$l;R$K$9$k$3$H$O$G$-$J$$(B.
! 287: @samp{/*} $B$,$$$/$D$"$C$F$b:G=i$N$b$N$N$_$,M-8z$H$J$j(B, $B:G=i$K8=$l$?(B
! 288: @samp{*/} $B$G%3%a%s%H$O=*N;$7$?$H8+$J$5$l$k(B. $B%W%m%0%i%`$J$I$G(B, $B%3%a%s%H(B
! 289: $B$r4^$`2DG=@-$,$"$kItJ,$r%3%a%s%H%"%&%H$7$?>l9g$K$O(B, @code{#if 0},
! 290: @code{#endif}$B$r;H$($P$h$$(B. (@xref{$B%W%j%W%m%;%C%5(B})
! 291:
! 292: @example
! 293: #if 0
! 294: def bfo(X) @{
! 295: /* empty */
! 296: @}
! 297: #endif
! 298: @end example
! 299:
! 300: @node $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 301: @subsection $BJ8(B
! 302:
! 303: @noindent
! 304: @b{Asir} $B$N%f!<%6H!?t$O(B,
! 305:
! 306: @example
! 307: def $BL>A0(B($B0z?t(B,$B0z?t(B,...,$B0z?t(B) @{
! 308: $BJ8(B
! 309: $BJ8(B
! 310: ...
! 311: $BJ8(B
! 312: @}
! 313: @end example
! 314:
! 315: @noindent
! 316: $B$H$$$&7A$GDj5A$5$l$k(B. $B$3$N$h$&$K(B, $BJ8$OH!?t$N4pK\E*9=@.MWAG$G$"$j(B, $B%W%m(B
! 317: $B%0%i%`$r=q$/$?$a$K$O(B, $BJ8$,$I$N$h$&$J$b$N$G$"$k$+CN$i$J$1$l$P$J$i$J$$(B.
! 318: $B:G$bC1=c$JJ8$H$7$F(B, $BC1J8$,$"$k(B. $B$3$l$O(B,
! 319:
! 320: @example
! 321: S = sum(N);
! 322: @end example
! 323:
! 324: @noindent
! 325: $B$N$h$&$K(B, $B<0$K=*C<5-9f(B (@samp{;} $B$^$?$O(B @samp{$}) $B$r$D$1$?$b$N$G$"$k(B.
! 326: $B$3$NC1J85Z$SN`;w$N(B @code{return} $BJ8(B, @code{break} $BJ8$J$I$,J8$N:G>.9=@.(B
! 327: $BC10L$H$J$k(B. @code{if} $BJ8$d(B @code{for} $BJ8$NDj5A(B (@xref{$BJ8K!$N>\:Y(B}) $B$r8+$l(B
! 328: $B$P$o$+$kDL$j(B, $B$=$l$i$NK\BN$O(B, $BC1$J$k0l$D$NJ8$H$7$FDj5A$5$l$F$$$k(B. $BDL>o(B
! 329: $B$O(B, $BK\BN$K$OJ#?t$NJ8$,=q$1$k$3$H$,I,MW$H$J$k(B. $B$3$N$h$&$J>l9g(B,
! 330: @samp{@{} $B$H(B @samp{@}} $B$GJ8$NJB$S$r3g$C$F(B, $B0l$D$NJ8$H$7$F07$&$3$H$,$G(B
! 331: $B$-$k(B. $B$3$l$rJ#J8$H8F$V(B.
! 332:
! 333: @example
! 334: if ( I == 0 ) @{
! 335: J = 1;
! 336: K = 2;
! 337: L = 3;
! 338: @}
! 339: @end example
! 340:
! 341: @noindent
! 342: @samp{@}} $B$N8e$m$K$O=*C<5-9f$OI,MW$J$$(B. $B$J$<$J$i(B, @samp{@{} $BJ8JB$S(B
! 343: @samp{@}}$B$,4{$KJ8$H$J$C$F$$$F(B, @code{if} $BJ8$NMW@A$rK~$?$7$F$$$k$+$i$G(B
! 344: $B$"$k(B.
! 345:
! 346: @node return $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 347: @subsection @code{return} $BJ8(B
! 348:
! 349: @noindent
! 350: @code{return} $BJ8$O(B,
! 351:
! 352: @example
! 353: return $B<0(B;
! 354:
! 355: return;
! 356: @end example
! 357:
! 358: @noindent
! 359: $B$N(B 2 $B$D$N7A<0$,$"$k(B. $B$$$:$l$bH!?t$+$iH4$1$k$?$a$NJ8$G$"$k(B. $BA0<T$O(B
! 360: $BH!?t$NCM$H$7$F(B $B<0(B $B$rJV$9(B. $B8e<T$G$O(B, $BH!?t$NCM$H$7$F2?$,JV$5$l$k$+(B
! 361: $B$O$o$+$i$J$$(B.
! 362:
! 363: @node if $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 364: @subsection @code{if} $BJ8(B
! 365:
! 366: @noindent
! 367: @code{if} $BJ8$K$O(B
! 368:
! 369: @example
! 370: if ( $B<0(B ) if ( $B<0(B )
! 371: $BJ8(B $B5Z$S(B $BJ8(B
! 372: else
! 373: $BJ8(B
! 374: @end example
! 375:
! 376: @noindent
! 377: $B$N(B 2 $B<oN`$,$"$k(B. $B$3$l$i$NF0:n$OL@$i$+$G$"$k$,(B, $BJ8$N0LCV$K(B @code{if} $BJ8(B
! 378: $B$,Mh$?>l9g$KCm0U$rMW$9$k(B. $B<!$NNc$r9M$($F$_$h$&(B.
! 379:
! 380: @example
! 381: if ( $B<0(B )
! 382: if ( $B<0(B ) $BJ8(B
! 383: else
! 384: $BJ8(B
! 385: @end example
! 386:
! 387: @noindent
! 388: $B$3$N>l9g(B, $B;z2<$2$+$i$O(B, @code{else} $B0J2<$O(B, $B:G=i$N(B @code{if} $B$KBP1~$9$k(B
! 389: $B$h$&$K8+$($k$,(B, $B%Q!<%6$O(B, $B<+F0E*$K(B 2 $BHVL\$N(B @code{if} $B$KBP1~$9$k$HH=CG$9$k(B.
! 390: $B$9$J$o$A(B, 2 $B<oN`$N(B @code{if} $BJ8$r5v$7$?$?$a$K(B, $BJ8K!$K[#Kf@-$,8=$l(B, $B$=$l$r(B
! 391: $B2r>C$9$k$?$a$K(B, @code{else} $B0J2<$O(B, $B:G$b6a$$(B @code{if} $B$KBP1~$9$k$H(B
! 392: $B$$$&5,B'$,E,MQ$5$l$k$N$G$"$k(B. $B=>$C$F(B, $B$3$NNc$O(B,
! 393:
! 394: @example
! 395: if ( $B<0(B ) @{
! 396: if ( $B<0(B ) $BJ8(B else $BJ8(B
! 397: @}
! 398: @end example
! 399:
! 400: @noindent
! 401: $B$H$$$&0UL#$H$J$k(B. $B;z2<$2$KBP1~$5$;$k$?$a$K$O(B,
! 402:
! 403: @example
! 404: if ( $B<0(B ) @{
! 405: if ( $B<0(B ) $BJ8(B
! 406: @} else
! 407: $BJ8(B
! 408: @end example
! 409:
! 410: @noindent
! 411: $B$H$7$J$1$l$P$J$i$J$$(B.
! 412:
! 413: @node $B%k!<%W(B break return continue,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 414: @subsection $B%k!<%W(B, @code{break}, @code{return}, @code{continue}
! 415:
! 416: @noindent
! 417: $B%k!<%W$r9=@.$9$kJ8$O(B, @code{while} $BJ8(B, @code{for} $BJ8(B, @code{do} $BJ8(B
! 418: $B$N(B 3 $B<oN`$,$"$k(B.
! 419:
! 420: @itemize @bullet
! 421: @item
! 422: @code{while} $BJ8(B
! 423:
! 424: $B7A<0$O(B,
! 425:
! 426: @example
! 427: while ( $B<0(B ) $BJ8(B
! 428: @end example
! 429:
! 430: @noindent
! 431: $B$G(B, $B$3$l$O(B, $B<0(B $B$rI>2A$7$F(B, $B$=$NCM$,(B 0 $B$G$J$$8B$j(B $BJ8(B $B$r<B9T$9$k$H$$$&(B
! 432: $B0UL#$H$J$k(B. $B$?$H$($P(B $B<0(B $B$,(B 1 $B$J$i$P(B, $BC1=c$JL58B%k!<%W$H$J$k(B.
! 433:
! 434: @item
! 435: @code{for} $BJ8(B
! 436:
! 437: $B7A<0$O(B,
! 438:
! 439: @example
! 440: for ( $B<0JB$S(B-1; $B<0(B; $B<0JB$S(B-2 ) $BJ8(B
! 441: @end example
! 442:
! 443: $B$G(B, $B$3$l$O(B
! 444:
! 445: @example
! 446: $B<0JB$S(B-1 ($B$rC1J8JB$S$K$7$?$b$N(B)
! 447: while ( $B<0(B ) @{
! 448: $BJ8(B
! 449: $B<0JB$S(B-2 ($B$rC1J8JB$S$K$7$?$b$N(B)
! 450: @}
! 451: @end example
! 452:
! 453: $B$HEy2A$G$"$k(B.
! 454:
! 455: @item
! 456: @code{do} $BJ8(B
! 457:
! 458: @example
! 459: do @{
! 460: $BJ8(B
! 461: @} while ( $B<0(B )
! 462: @end example
! 463:
! 464: $B$O(B, $B@h$K(B $BJ8$r<B9T$7$F$+$i>r7o<0$K$h$kH=Dj$r9T$&=j$,(B @code{while} $BJ8(B
! 465: $B$H0[$J$C$F$$$k(B.
! 466: @end itemize
! 467:
! 468: @noindent
! 469: $B%k!<%W$rH4$1=P$9<jCJ$H$7$F(B,
! 470: @code{break} $BJ85Z$S(B @code{return} $BJ8$,$"$k(B. $B$^$?(B, $B%k!<%W$N@)8f$r(B
! 471: $B$"$k0LCV$K0\$9<jCJ$H$7$F(B @code{continue} $BJ8$,$"$k(B.
! 472:
! 473: @itemize @bullet
! 474:
! 475: @item
! 476: @code{break}
! 477:
! 478: @code{break} $BJ8$O(B, $B$=$l$r0O$`%k!<%W$r0l$D$@$1H4$1$k(B.
! 479:
! 480: @item
! 481: @code{return}
! 482:
! 483: @code{return} $BJ8$O(B, $B0lHL$KH!?t$+$iH4$1$k$?$a$NJ8$G$"$j(B,
! 484: $B%k!<%W$NCf$+$i$G$bM-8z$G$"$k(B.
! 485:
! 486: @item
! 487: @code{continue}
! 488:
! 489: @code{continue} $BJ8$O(B, $B%k!<%W$NK\BN$NJ8$NKvC<$K@)8f$r0\$9(B.
! 490: $BNc$($P(B @code{for} $BJ8$G$O(B, $B:G8e$N<0JB$S$N<B9T$r9T$$(B, @code{while}
! 491: $BJ8$G$O>r7o<0$NH=Dj$K0\$k(B.
! 492: @end itemize
! 493:
! 494: @node $B$5$^$6$^$J<0(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 495: @subsection $B$5$^$6$^$J<0(B
! 496:
! 497: @noindent
! 498: $B<g$J<0$N9=@.MWAG$H$7$F$O(B, $B<!$N$h$&$J$b$N$,$"$k(B.
! 499:
! 500: @itemize @bullet
! 501: @item
! 502: $B2C8:>h=|(B, $BQQ(B
! 503:
! 504: $BQQ$O(B, @samp{^} $B$K$h$jI=$9(B. $B=|;;(B @samp{/} $B$O(B, $BBN$H$7$F$N1i;;$KMQ$$$k(B.
! 505: $BNc$($P(B, @code{2/3} $B$OM-M}?t$N(B @code{2/3} $B$rI=$9(B.
! 506: $B@0?t=|;;(B, $BB?9`<0=|;;(B ($B>jM>$r4^$`1i;;(B) $B$K$OJLESAH$_9~$_H!?t$,MQ0U$5$l$F$$$k(B.
! 507:
! 508: @example
! 509: x+1 A^2*B*afo X/3
! 510: @end example
! 511:
! 512: @item
! 513: $B%$%s%G%C%/%9$D$-$NJQ?t(B
! 514:
! 515: $B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$NMWAG$O%$%s%G%C%/%9$rMQ$$$k$3$H$K$h$j<h$j=P$;$k(B.
! 516: $B%$%s%G%C%/%9$O(B 0 $B$+$i;O$^$k$3$H$KCm0U$9$k(B. $B<h$j=P$7$?MWAG$,%Y%/%H%k(B,
! 517: $B9TNs(B, $B%j%9%H$J$i(B, $B$5$i$K%$%s%G%C%/%9$r$D$1$k$3$H$bM-8z$G$"$k(B.
! 518:
! 519: @example
! 520: V[0] M[1][2]
! 521: @end example
! 522:
! 523: @item
! 524: $BHf3S1i;;(B
! 525:
! 526: $BEy$7$$(B (@samp{==}), $BEy$7$/$J$$(B (@samp{!=}), $BBg>.(B (@samp{>}, @samp{<},
! 527: @samp{>=}, @samp{<=}) $B$N(B 2 $B9`1i;;$,$"$k(B. $B??$J$i$PM-M}?t$N(B 1, $B56$J$i$P(B
! 528: 0 $B$rCM$K;}$D(B.
! 529:
! 530: @item
! 531: $BO@M}<0(B
! 532:
! 533: $BO@M}@Q(B (@samp{&&}), $BO@M}OB(B (@samp{||}) $B$N(B 2 $B9`1i;;$H(B, $BH]Dj(B (@samp{!})
! 534: $B$,MQ0U$5$l$F$$$k(B. $BCM$O$d$O$j(B 1, 0 $B$G$"$k(B.
! 535:
! 536: @item
! 537: $BBeF~(B
! 538:
! 539: $BDL>o$NBeF~$O(B @samp{=} $B$G9T$&(B. $B$3$N$[$+(B, $B;;=Q1i;;;R$HAH$_9g$o$;$F(B
! 540: $BFC<l$JBeF~$r9T$&$3$H$b$G$-$k(B.
! 541: (@samp{+=}, @samp{-=}, @samp{*=}, @samp{/=}, @samp{^=})
! 542:
! 543: @example
! 544: A = 2 A *= 3 ($B$3$l$O(B A = A*3 $B$HF1$8(B; $B$=$NB>$N1i;;;R$bF1MM(B)
! 545: @end example
! 546: @item
! 547: $BH!?t8F$S=P$7(B
! 548:
! 549: $BH!?t8F$S=P$7$b<0$N0l<o$G$"$k(B.
! 550:
! 551: @item
! 552: @samp{++}, @samp{--}
! 553:
! 554: $B$3$l$i$O(B, $BJQ?t$NA08e$K$D$$$F(B, $B$=$l$>$l<!$N$h$&$JA`:n(B, $BCM$rI=$9(B.
! 555:
! 556: @example
! 557: A++ $BCM$O85$N(B A $B$NCM(B, A = A+1
! 558: A-- $BCM$O85$N(B A $B$NCM(B, A = A-1
! 559: ++A A = A+1, $BCM$OJQ2=8e$NCM(B
! 560: --A A = A-1, $BCM$OJQ2=8e$NCM(B
! 561: @end example
! 562:
! 563: @end itemize
! 564:
! 565: @node $B%W%j%W%m%;%C%5(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
! 566: @subsection $B%W%j%W%m%;%C%5(B
! 567:
! 568: @noindent
! 569: @b{Asir} $B$N%f!<%68@8l$O(B C $B8@8l$rLO$7$?$b$N$G$"$k(B. C $B$NFCD'$H$7$F(B,
! 570: $B%W%j%W%m%;%C%5(B @code{cpp} $B$K$h$k%^%/%mE83+(B, $B%U%!%$%k$N%$%s%/%k!<%I(B
! 571: $B$,$"$k$,(B, @b{Asir} $B$K$*$$$F$b%f!<%68@8l%U%!%$%k$NFI$_9~$_$N:](B
! 572: @code{cpp} $B$rDL$7$F$+$iFI$_9~$`$3$H$H$7$?(B. $B$3$l$K$h$j%f!<%68@8l(B
! 573: $B%U%!%$%kCf$G(B @code{#include}, @code{#define}, @code{#if} $B$J$I$,;H$($k(B.
! 574:
! 575: @itemize @bullet
! 576: @item
! 577: @code{#include}
! 578:
! 579: @code{cpp} $B$KFC$K0z?t$rEO$5$J$$$?$a(B, $B%$%s%/%k!<%I%U%!%$%k$O(B,
! 580: @code{#include} $B$,=q$+$l$F$$$k%U%!%$%k$HF1$8%G%#%l%/%H%j$G%5!<%A$5$l$k(B.
! 581:
! 582: @item
! 583: @code{#define}
! 584:
! 585: $B$3$l$O(B, C $B$K$*$1$k$N$HA4$/F1MM$KMQ$$$k$3$H$,$G$-$k(B.
! 586:
! 587: @item
! 588: @code{#if}
! 589:
! 590: @code{/*}, @code{*/} $B$K$h$k%3%a%s%H$OF~$l;R$K$G$-$J$$$N$G(B, $B%W%m%0%i%`(B
! 591: $B$NBg$-$JItJ,$r%3%a%s%H%"%&%H$9$k:]$K(B, @code{#if 0}, @code{#endif}
! 592: $B$r;H$&$HJXMx$G$"$k(B.
! 593: @end itemize
! 594:
! 595: @noindent
! 596: $B<!$NNc$O(B, @samp{defs.h} $B$K$"$k%^%/%mDj5A$G$"$k(B.
! 597:
! 598: @example
! 599: #define ZERO 0
! 600: #define NUM 1
! 601: #define POLY 2
! 602: #define RAT 3
! 603: #define LIST 4
! 604: #define VECT 5
! 605: #define MAT 6
! 606: #define STR 7
! 607: #define N_Q 0
! 608: #define N_R 1
! 609: #define N_A 2
! 610: #define N_B 3
! 611: #define N_C 4
! 612: #define V_IND 0
! 613: #define V_UC 1
! 614: #define V_PF 2
! 615: #define V_SR 3
! 616: #define isnum(a) (type(a)==NUM)
! 617: #define ispoly(a) (type(a)==POLY)
! 618: #define israt(a) (type(a)==RAT)
! 619: #define islist(a) (type(a)==LIST)
! 620: #define isvect(a) (type(a)==VECT)
! 621: #define ismat(a) (type(a)==MAT)
! 622: #define isstr(a) (type(a)==STR)
! 623: #define FIRST(L) (car(L))
! 624: #define SECOND(L) (car(cdr(L)))
! 625: #define THIRD(L) (car(cdr(cdr(L))))
! 626: #define FOURTH(L) (car(cdr(cdr(cdr(L)))))
! 627: #define DEG(a) deg(a,var(a))
! 628: #define LCOEF(a) coef(a,deg(a,var(a)))
! 629: #define LTERM(a) coef(a,deg(a,var(a)))*var(a)^deg(a,var(a))
! 630: #define TT(a) car(car(a))
! 631: #define TS(a) car(cdr(car(a)))
! 632: #define MAX(a,b) ((a)>(b)?(a):(b))
! 633: @end example
! 634:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>