[BACK]Return to appendix.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts

Diff for /OpenXM/src/asir-doc/parts/appendix.texi between version 1.4 and 1.6

version 1.4, 1999/12/24 04:38:04 version 1.6, 2000/03/17 08:27:28
Line 1 
Line 1 
 @comment $OpenXM: OpenXM/src/asir-doc/parts/appendix.texi,v 1.3 1999/12/21 02:47:30 noro Exp $  @comment $OpenXM: OpenXM/src/asir-doc/parts/appendix.texi,v 1.5 2000/03/17 02:17:03 noro Exp $
 \BJP  \BJP
 @node $BIUO?(B,,, Top  @node $BIUO?(B,,, Top
 @appendix $BIUO?(B  @appendix $BIUO?(B
Line 13 
Line 13 
 * $BJ8K!$N>\:Y(B::  * $BJ8K!$N>\:Y(B::
 * $BE:IU$N%f!<%6Dj5AH!?t%U%!%$%k(B::  * $BE:IU$N%f!<%6Dj5AH!?t%U%!%$%k(B::
 * $BF~NO%$%s%?%U%'!<%9(B::  * $BF~NO%$%s%?%U%'!<%9(B::
   * $B%i%$%V%i%j%$%s%?%U%'!<%9(B::
 * $BJQ99E@(B::  * $BJQ99E@(B::
 * $BJ88%(B::  * $BJ88%(B::
 \E  \E
Line 20 
Line 21 
 * Details of syntax::  * Details of syntax::
 * Files of user defined functions::  * Files of user defined functions::
 * Input interfaces::  * Input interfaces::
   * Library interfaces::
 * Changes::  * Changes::
 * References::  * References::
 \E  \E
Line 421  correctly.
Line 423  correctly.
 @item fctrdata  @item fctrdata
 \BJP  \BJP
 @samp{fctrtest} $B$G;H$o$l$F$$$kNc$r4^$`(B, $B0x?tJ,2r%F%9%HMQ$NNc(B.  @samp{fctrtest} $B$G;H$o$l$F$$$kNc$r4^$`(B, $B0x?tJ,2r%F%9%HMQ$NNc(B.
 @code{Alg[]} $B$K<}$a$i$l$F$$$kNc$O(B, @code{af()} (@xref{asq af}) $BMQ$NNc$G$"$k(B.  @code{Alg[]} $B$K<}$a$i$l$F$$$kNc$O(B, @code{af()} (@xref{asq af af_noalg}) $BMQ$NNc$G$"$k(B.
 \E  \E
 \BEG  \BEG
 This contains example polynomials for factorization.  It includes  This contains example polynomials for factorization.  It includes
 polynomials used in @samp{fctrtest}.  polynomials used in @samp{fctrtest}.
 Polynomials contained in vector @code{Alg[]} is for the algebraic  Polynomials contained in vector @code{Alg[]} is for the algebraic
 factorization @code{af()} (@xref{asq af}).  factorization @code{af()} (@xref{asq af af_noalg}).
 \E  \E
 @example  @example
 [45] load("sp")$  [45] load("sp")$
Line 636  is available via ftp.
Line 638  is available via ftp.
 The way of setting up and the usage can be found at the top of  The way of setting up and the usage can be found at the top of
 @samp{asir.el}.  @samp{asir.el}.
 \E  \E
   
   \BJP
   @node $B%i%$%V%i%j%$%s%?%U%'!<%9(B,,, $BIUO?(B
   @section $B%i%$%V%i%j%$%s%?%U%'!<%9(B
   \E
   \BEG
   @node Library interfaces,,, Appendix
   @section Library interfaces
   \E
   
   \BJP
   @b{Asir} $B$NDs6!$9$k5!G=$rB>$N%W%m%0%i%`$+$i;HMQ$9$kJ}K!$H$7$F(B, @b{OpenXM} $B$K$h$k(B
   $BB>$K(B, $B%i%$%V%i%j$ND>@\%j%s%/$K$h$kJ}K!$,2DG=$G$"$k(B. $B%i%$%V%i%j$O(B,
   GC $B%i%$%V%i%j$G$"$k(B @samp{libasir-gc.a} $B$H$H$b$K(B @b{OpenXM}
   distribution (@code{http://www.math.kobe-u.ac.jp/OpenXM}) $B$K4^$^$l$k(B.
   $B8=>u$G$O(B@b{OpenXM} $B%$%s%?%U%'!<%9$N$_$,8x3+$5$l$F$$$k$?$a(B, $B0J2<$G$O(B
   @b{OpenXM} $B$,%$%s%9%H!<%k$5$l$F$$$k$H2>Dj$9$k(B. @b{OpenXM} root $B%G%#%l%/%H%j$r(B
   @code{$OpenXM_HOME}$B$H=q$/(B. $B%i%$%V%i%j%U%!%$%k$OA4$F(B @samp{$OpenXM_HOME/lib}
   $B$K$*$+$l$F$$$k(B. $B%i%$%V%i%j$K$O0J2<$N(B 3 $B<oN`$,$"$k(B.
   \E
   \BEG
   It is possible to link an @b{Asir} library to use the functionalities of
   @b{Asir} from other programs.
   The necessary libraries are included in the @b{OpenXM} distribution
   (@code{http://www.math.kobe-u.ac.jp/OpenXM}).
   At present only the @b{OpenXM} interfaces are available. Here we assume
   that @b{OpenXM} is already installed. In the following
   @code{$OpenXM_HOME} denotes the @b{OpenXM} root directory.
   All the library files are placed in @samp{$OpenXM_HOME/lib}.
   There are three kinds of libraries as follows.
   \E
   @itemize @bullet
   @item @samp{libasir.a}
   @*
   \BJP
   @b{PARI}, @b{X11} $B4XO"$N5!G=$r4^$^$J$$(B.
   $B%j%s%/$K$O(B @samp{libasir-gc.a} $B$N$_$,I,MW(B.
   \E
   \BEG
   It does not contain the functionalities related to @b{PARI} and @b{X11}.
   Only @samp{libasir-gc.a} is necessary for linking.
   \E
   
   @item @samp{libasir_pari.a}
   @*
   \BJP
   @b{X11} $B4XO"$N5!G=$r4^$^$J$$(B. $B%j%s%/$K$O(B @samp{libasir-gc.a},
   @samp{libpari.a} $B$,I,MW(B.
   \E
   \BEG
   It does not contain the functionalities related to @b{X11}.
   @samp{libasir-gc.a}, @samp{libpari.a} are necessary for linking.
   \E
   
   @item @samp{libasir_pari_X.a}
   @*
   \BJP
   $BA4$F$N5!G=$r4^$`(B. $B%j%s%/$K$O(B @samp{libasir-gc.a}, @samp{libpari.a}
   $B$*$h$S(B @b{X11} $B4XO"$N%i%$%V%i%j;XDj$,I,MW(B.
   \E
   \BEG
   All the functionalities are included. @samp{libasir-gc.a}, @samp{libpari.a}
   and libraries related to @b{X11} are necessary for linking.
   \E
   @end itemize
   \BJP
   $BDs6!$5$l$F$$$k4X?t$O0J2<$NDL$j$G$"$k(B.
   \E
   @itemize @bullet
   @item @code{int asir_ox_init(int @var{byteorder})}
   @*
   \BJP
   $B%i%$%V%i%j$N=i4|2=(B. @var{byteorder} $B$O%a%b%j>e$X$N%P%$%J%j(B CMO $B%G!<%?(B
   $B$X$NE83+J}K!$r;XDj$9$k(B. @var{byteorder} $B$,(B 0 $B$N$H$-%^%7%s8GM-$N(B byteorder
   $B$rMQ$$$k(B. 1 $B$N$H$-(B network byteorder $B$rMQ$$$k(B. $B=i4|2=$K@.8y$7$?>l9g(B 0,
   $B<:GT$N;~(B -1 $B$rJV$9(B.
   \E
   \BEG
   It initializes the library.
   @var{byteorder} specifies the format of binary CMO data on the memory.
   If @var{byteorder} is 0, the byteorder native to the machine is used.
   If @var{byteorder} is 1, the network byteorder is used. It returns
   0 if the initialization is successful, -1 otherwise.
   \E
   
   @item @code{void asir_ox_push_cmo(void *@var{cmo})}
   @*
   \BJP
   $B%a%b%j>e$KCV$+$l$?(B CMO $B%G!<%?$r(B @b{Asir} $B$NFbIt7A<0$KJQ49$7$F%9%?%C%/$K(B
   push $B$9$k(B.
   \E
   \BJP
   It converts CMO data pointed by @var{cmo} into an @b{Asir} object and
   it pushes the object onto the stack.
   \E
   
   @item @code{int asir_ox_peek_cmo_size()}
   @*
   \BJP
   $B%9%?%C%/$N:G>e0L$K$"$k(B @b{Asir} $B%G!<%?$r(B CMO $B$KJQ49$7$?$H$-$N%5%$%:$rJV$9(B.
   $BJQ49ITG=$J>l9g$K$O(B -1 $B$rJV$9(B.
   \E
   \BEG
   It returns the size of the object at the top of the stack as CMO object.
   It returns -1 if the object cannot be converted into CMO object.
   \E
   
   @item @code{int asir_ox_pop_cmo(void *@var{cmo}, int @var{limit})}
   @*
   \BJP
   $B%9%?%C%/$N:G>e0L$K$"$k(B @b{Asir} $B%G!<%?$r(B pop $B$7(B, CMO $B$KJQ49$7$F(B @var{cmo}$B$G(B
   $B;X$5$l$kG[Ns$K=q$-(B, CMO $B$N%5%$%:$rJV$9(B. $B$3$N$H$-(B, CMO $B$N%5%$%:$,(B
   @var{limit} $B$h$jBg$-$$>l9g$K$O(B -1 $B$rJV$9(B. @var{cmo} $B$OD9$5$,>/$J$/$H$b(B
   @var{limit}$B%P%$%H$NG[Ns$r;X$9I,MW$,$"$k(B. $BJQ49$5$l$?(B CMO $B$r<}MF$G$-$k(B
   $BG[Ns$ND9$5$rCN$k$?$a$K(B, @code{asir_ox_peek_cmo_size} $B$rMQ$$$k(B.
   \E
   \BEG
   It pops an @b{Asir} object at the top of the stack and it converts
   the object into CMO data. If the size of the CMO data is not greater
   than @var{limit}, then the data is written in @var{cmo} and the size
   is returned. Otherwise -1 is returned. The size of the array pointed
   by @var{cmo} must be at least @var{limit}. In order to know the size
   of converted CMO data in advance @code{asir_ox_peek_cmo_size} is called.
   \E
   
   @item @code{void asir_ox_push_cmd(int @var{cmd})}
   @*
   \BJP
   $B%9%?%C%/%^%7%s%3%^%s%I(B @var{cmd} $B$r<B9T$9$k(B.
   \E
   \BEG
   It executes a stack machine command @var{cmd}.
   \E
   
   @item @code{void asir_ox_execute_string(char *@var{str})}
   @*
   \BJP
   @b{Asir} $B$,<B9T2DG=$JJ8;zNs(B @var{str} $B$r<B9T$7(B, $B$=$N7k2L$r%9%?%C%/$K(B push $B$9$k(B.
   \E
   \BEG
   It evaluates @var{str} as a string written in the @b{Asir} user language.
   The result is pushed onto the stack.
   \E
   @end itemize
   
   \BJP
   include $B$9$Y$-(B header file $B$O(B @samp{$OpenXM_HOME/include/asir/ox.h} $B$G$"$k(B.
   $B$3$N(B header file $B$K$O(B, @b{OpenXM} $B$K4X$9$kA4$F$N(B tag, command $B$NDj5A$,4^$^$l$F(B
   $B$$$k(B.
   $B<!$NNc(B (@samp{$OpenXM_HOME/doc/oxlib/test3.c}) $B$O>e5-4X?t$N;HMQ(B
   $BK!$r<($9(B.
   \E
   \BEG
   A program calling the above functions should include
   @samp{$OpenXM_HOME/include/asir/ox.h}.
   In this file all the definitions of @b{OpenXM} tags and commands.
   The following example
   (@samp{$OpenXM_HOME/doc/oxlib/test3.c}) illustrates the usage of
   the above functions.
   \E
   
   @example
   #include <asir/ox.h>
   #include <signal.h>
   
   main(int argc, char **argv)
   @{
     char buf[BUFSIZ+1];
     int c;
     unsigned char sendbuf[BUFSIZ+10];
     unsigned char *result;
     unsigned char h[3];
     int len,i,j;
     static int result_len = 0;
     char *kwd,*bdy;
     unsigned int cmd;
   
     signal(SIGINT,SIG_IGN);
     asir_ox_init(1); /* 1: network byte order; 0: native byte order */
     result_len = BUFSIZ;
     result = (void *)malloc(BUFSIZ);
     while ( 1 ) @{
       printf("Input>"); fflush(stdout);
       fgets(buf,BUFSIZ,stdin);
       for ( i = 0; buf[i] && isspace(buf[i]); i++ );
       if ( !buf[i] )
         continue;
       kwd = buf+i;
       for ( ; buf[i] && !isspace(buf[i]); i++ );
       buf[i] = 0;
       bdy = buf+i+1;
       if ( !strcmp(kwd,"asir") ) @{
         sprintf(sendbuf,"%s;",bdy);
         asir_ox_execute_string(sendbuf);
       @} else if ( !strcmp(kwd,"push") ) @{
         h[0] = 0;
         h[2] = 0;
         j = 0;
         while ( 1 ) @{
           for ( ; (c= *bdy) && isspace(c); bdy++ );
           if ( !c )
             break;
           else if ( h[0] ) @{
             h[1] = c;
             sendbuf[j++] = strtoul(h,0,16);
             h[0] = 0;
           @} else
             h[0] = c;
           bdy++;
         @}
         if ( h[0] )
           fprintf(stderr,"Number of characters is odd.\n");
         else @{
           sendbuf[j] = 0;
           asir_ox_push_cmo(sendbuf);
         @}
       @} else if ( !strcmp(kwd,"cmd") ) @{
         cmd = atoi(bdy);
         asir_ox_push_cmd(cmd);
       @} else if ( !strcmp(kwd,"pop") ) @{
         len = asir_ox_peek_cmo_size();
         if ( !len )
           continue;
         if ( len > result_len ) @{
           result = (char *)realloc(result,len);
           result_len = len;
         @}
         asir_ox_pop_cmo(result,len);
         printf("Output>"); fflush(stdout);
         printf("\n");
         for ( i = 0; i < len; ) @{
           printf("%02x ",result[i]);
           i++;
           if ( !(i%16) )
             printf("\n");
         @}
         printf("\n");
       @}
     @}
   @}
   @end example
   \BJP
   $B$3$N%W%m%0%i%`$O(B, @var{keyword} @var{body} $B$J$k(B 1 $B9T$rF~NO$H$7$F<u$1<h$j(B
   @var{keyword} $B$K1~$8$F<!$N$h$&$JF0:n$r9T$&(B.
   \E
   \BEG
   This program receives a line in the form of @var{keyword} @var{body}
   as an input and it executes the following operations according to
   @var{keyword}.
   \E
   @itemize @bullet
   @item @code{asir} @var{body}
   @*
   \BJP
   @var{body} $B$r(B @b{Asir} $B8@8l$G=q$+$l$?<0$H$_$J$7(B, $B<B9T7k2L$r%9%?%C%/$K(B push $B$9$k(B.
   @code{asir_ox_execute_string()} $B$,MQ$$$i$l$k(B.
   \E
   \BEG
   @var{body} is regarded as an expression written in the @b{Asir} user language.
   The expression is evaluated and the result is pushed onto the stack.
   @code{asir_ox_execute_string()} is called.
   \E
   
   @item @code{push} @var{body}
   @*
   \BJP
   @var{body} $B$r(B 16 $B?J?t$GI=<($5$l$?(B CMO $B%G!<%?$H$_$J$7(B, @b{Asir} $B%*%V%8%'%/%H$KJQ49(B
   $B$7$F%9%?%C%/$K(B push $B$9$k(B. @code{asir_ox_push_cmo()} $B$,MQ$$$i$l$k(B.
   \E
   \BEG
   @var{body} is regarded as a CMO object in the hexadecimal form.
   The CMO object is converted into an @b{Asir} object and is pushed onto the stack.
   @code{asir_ox_push_cmo()} is called.
   \E
   
   @item @code{pop}
   @*
   \BJP
   $B%9%?%C%/:G>e0L$N%*%V%8%'%/%H$r(B CMO $B$KJQ49$7(B, 16 $B?J?t$GI=<($9$k(B.
   @code{asir_ox_peek_cmo_size()} $B$*$h$S(B @code{asir_ox_pop_cmo()} $B$,MQ$$$i$l$k(B.
   \E
   \BEG
   The object at the top of the stack is converted into a CMO object
   and it is displayed in the hexadecimal form.
   @code{asir_ox_peek_cmo_size()} and @code{asir_ox_pop_cmo()} are called.
   \E
   
   @item @code{cmd} @var{body}
   @*
   \BJP
   @var{body} $B$r(B SM $B%3%^%s%I$H$_$J$7(B, $B<B9T$9$k(B.
   @code{asir_ox_push_cmd()} $B$,MQ$$$i$l$k(B.
   \E
   \BEG
   @var{body} is regarded as an SM command and the command is executed.
   @code{asir_ox_push_cmd()} is called.
   \E
   @end itemize
   
 \BJP  \BJP
 @node $BJQ99E@(B,,, $BIUO?(B  @node $BJQ99E@(B,,, $BIUO?(B

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>