version 1.1, 2001/04/23 05:45:35 |
version 1.2, 2003/04/19 10:36:29 |
|
|
@comment $OpenXM$ |
@comment $OpenXM: OpenXM/src/asir-doc/int-parts/macro.texi,v 1.1 2001/04/23 05:45:35 noro Exp $ |
@chapter $B%^%/%m(B, $BBg0hJQ?t(B |
\JP @chapter $B%^%/%m(B, $BBg0hJQ?t(B |
|
\EG @chapter Macros and global variables |
|
|
@section macro |
@section macro |
@samp{ca.h} $B$GDj5A$5$l$k<g$J%^%/%m$O<!$NDL$j$G$"$k(B. |
\JP @samp{ca.h} $B$GDj5A$5$l$k<g$J%^%/%m$O<!$NDL$j$G$"$k(B. |
@subsection $B0lHL%^%/%m(B |
\EG @samp{ca.h} |
|
\JP @subsection $B0lHL%^%/%m(B |
|
\EG @subsection General macros |
@table @code |
@table @code |
@item MAX(a,b) |
@item MAX(a,b) |
@code{((a) > (b) ? (a) : (b) )} |
@code{((a) > (b) ? (a) : (b) )} |
|
|
@code{((n)->b)} |
@code{((n)->b)} |
@end table |
@end table |
|
|
@subsection $B=R8l(B |
\JP @subsection $B=R8l(B |
|
\EG @subsection Predicates |
@table @code |
@table @code |
@item NUM(a) |
@item NUM(a) |
@code{ID(a)==O_Q} |
@code{ID(a)==O_Q} |
@item INT(a) |
@item INT(a) |
@code{(!DN(a))} |
@code{(!DN(a))} |
@item UNIQ(a) |
@item UNIQ(a) |
@code{a $B$,M-M}?t$N(B 1 $B$KEy$7$$(B} |
\JP @code{a} $B$,M-M}?t$N(B 1 $B$KEy$7$$(B |
|
\EG @code{a} is equal to 1 as a rational number. |
@item MUNIQ(a) |
@item MUNIQ(a) |
@code{a $B$,M-M}?t$N(B -1 $B$KEy$7$$(B} |
\JP @code{a} $B$,M-M}?t$N(B -1 $B$KEy$7$$(B |
|
\EG @code{a} is equal to -1 as a rational number. |
@item UNIN(a) |
@item UNIN(a) |
@code{a $B$,<+A3?t$N(B 1 $B$KEy$7$$(B} |
\JP @code{a} $B$,<+A3?t$N(B 1 $B$KEy$7$$(B |
|
\EG @code{a} is equal to 1 as a natural number. |
@end table |
@end table |
|
|
@subsection $B%a%b%j3d$jEv$F4o(B |
\JP @subsection $B%a%b%j3d$jEv$F4o(B |
|
\EG @subsection Memory allocators |
@table @code |
@table @code |
@item (char *) MALLOC(d) |
@item (char *) MALLOC(d) |
@code{d bytes $B$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{d} bytes $B$NNN0h$r3d$jEv$F$k(B. |
|
\EG allocates a byte array of length @code{d} bytes. |
@item (char *) CALLOC(d,e) |
@item (char *) CALLOC(d,e) |
@code{d * e bytes $B$NNN0h$r3d$jEv$F$F(B, 0 $B$G=i4|2=$9$k(B. } |
\JP @code{d * e} bytes $B$NNN0h$r3d$jEv$F$F(B, 0 $B$G=i4|2=$9$k(B. |
|
\EG allocates a byte array of @code{d * e} bytes, and sets all that |
|
region to 0. |
@item (N) NALLOC(d) |
@item (N) NALLOC(d) |
@code{d $B7e$N<+A3?tMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{d} $B7e$N<+A3?tMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG allocates a region for a natural number of @code{d} digits. |
@end table |
@end table |
@noindent |
@noindent |
$B$3$l$i$O$9$Y$FNN0h$N@hF,%]%$%s%?$rJV$9(B. |
\JP $B$3$l$i$O$9$Y$FNN0h$N@hF,%]%$%s%?$rJV$9(B. |
|
\EG These macros return a pointer to the allocate memory. |
|
|
@subsection cell allocators |
@subsection cell allocators |
@table @code |
@table @code |
@item NEWQ(q) |
@item NEWQ(q) |
@code{q $B$K(B Q $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{q} $B$K(B \code{Q} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWP(p) |
@item NEWP(p) |
@code{p $B$K(B P $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{p} $B$K(B \code{P} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWR(r) |
@item NEWR(r) |
@code{r $B$K(B R $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{r} $B$K(B \code{R} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWNODE(a) |
@item NEWNODE(a) |
@code{a $B$K(B NODE $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{a} $B$K(B \code{NODE} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWDC(dc) |
@item NEWDC(dc) |
@code{dc $B$K(B DCP $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{dc} $B$K(B \code{DCP} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWV(v) |
@item NEWV(v) |
@code{v $B$K(B V $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{v} $B$K(B \code{V} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@item NEWVL(vl) |
@item NEWVL(vl) |
@code{vl $B$K(B VL $BMQ$NNN0h$r3d$jEv$F$k(B. } |
\JP @code{vl} $B$K(B \code{VL} $BMQ$NNN0h$r3d$jEv$F$k(B. |
|
\EG |
@end table |
@end table |
@noindent |
@noindent |
|
\BJP |
@code{NEWP()}, @code{NEWQ()}, @code{NEWR()} $B$K$*$$$F$O(B, $B%a%s%P(B @code{id} |
@code{NEWP()}, @code{NEWQ()}, @code{NEWR()} $B$K$*$$$F$O(B, $B%a%s%P(B @code{id} |
$B$b$7$+$k$Y$-CM$K=i4|2=$5$l$k(B. |
$B$b$7$+$k$Y$-CM$K=i4|2=$5$l$k(B. |
|
\E |
|
\BEG |
|
\E |
|
|
@section $B<g$JBg0hJQ?t(B |
\JP @section $B<g$JBg0hJQ?t(B |
|
\EG @section Global variables |
@table @code |
@table @code |
@item VL CO; |
@item VL CO; |
@code{$B8=:_$NJQ?t=g=x(B. } |
\JP $B8=:_$NJQ?t=g=x(B. |
|
\EG |
@item Q ONE; |
@item Q ONE; |
@code{$BM-M}?t$N(B 1. } |
\JP $BM-M}?t$N(B 1. |
|
\EG |
@item N ONEN; |
@item N ONEN; |
@code{$B<+A3?t$N(B 1. } |
\JP $B<+A3?t$N(B 1. |
|
\EG |
@item int prime[]; |
@item int prime[]; |
@code{4 $B7e$^$G$NAG?t(B($B>.(B->$BBg(B). } |
\JP 4 $B7e$^$G$NAG?t(B($B>.(B->$BBg(B). |
|
\EG |
@item int lprime[]; |
@item int lprime[]; |
@code{8 $B7eDxEY$NAG?t(B 1000 $B8D(B($BBg(B->$B>.(B). } |
\JP 8 $B7eDxEY$NAG?t(B 1000 $B8D(B($BBg(B->$B>.(B). |
|
\EG |
@end table |
@end table |
@noindent |
@noindent |
|
\BJP |
@code{CO} $B$O(B, $B%f!<%6$,=i4|2=(B, $B$*$h$S?7$?$KJQ?t$,=P8=$7$?>l9g$K99?7$9$kI,(B |
@code{CO} $B$O(B, $B%f!<%6$,=i4|2=(B, $B$*$h$S?7$?$KJQ?t$,=P8=$7$?>l9g$K99?7$9$kI,(B |
$BMW$,$"$k(B. $B$^$?(B, @code{ONER}, @code{ONE}, @code{ONEN}$B$O(B, $B5/F0;~$KH!?t(B |
$BMW$,$"$k(B. $B$^$?(B, @code{ONER}, @code{ONE}, @code{ONEN}$B$O(B, $B5/F0;~$KH!?t(B |
@code{nglob_init()} $B$K$h$j=i4|2=$9$kI,MW$,$"$k(B. |
@code{nglob_init()} $B$K$h$j=i4|2=$9$kI,MW$,$"$k(B. |
|
\E |
|
\BEG |
|
\E |