[BACK]Return to test1.c CVS log [TXT][DIR] Up to [local] / OpenXM / doc / oxlib

Annotation of OpenXM/doc/oxlib/test1.c, Revision 1.5

1.5     ! ohara       1: /* $OpenXM: OpenXM/doc/oxlib/test1.c,v 1.4 2003/03/08 07:49:59 takayama Exp $ */
        !             2: #include <stdio.h>
1.4       takayama    3: #include <ox/cmotag.h>
                      4: #include <ox/smCommand.h>
                      5:
1.1       takayama    6:
                      7: main() {
                      8:   hoge();
                      9: }
                     10:
                     11: hoge() {
                     12:   /*  (CMO_ZZ,12); */
                     13:   unsigned char cmo0[]=
                     14:   {00, 00, 00, 0x14,
                     15:    00, 00, 00, 01, 00, 00, 00, 0xc};
                     16:
                     17:   /* (CMO_ZZ,8) */
                     18:   unsigned char cmo1[] =
                     19:   {00, 00, 00, 0x14,
                     20:    00, 00, 00, 01, 00, 00, 00, 8};
                     21:
                     22:   /* (CMO_INT32,2); */
                     23:   unsigned char cmo2[] =
                     24:   { 00, 00, 00, 02, 00, 00, 00, 02};
                     25:
                     26:   /* (CMO_STRING,"igcd") */
                     27:   unsigned char cmo3[] =
                     28:   {00, 00, 00, 04, 00, 00, 00, 04,
                     29:    0x69,0x67,0x63,0x64 };
                     30:   unsigned char cmo[1024];
1.2       takayama   31:   int i,size;
1.1       takayama   32:
1.3       noro       33:   asir_ox_init(1);
1.1       takayama   34:   asir_ox_push_cmo(cmo0);
                     35:   asir_ox_push_cmo(cmo1);
                     36:   asir_ox_push_cmo(cmo2);
                     37:   asir_ox_push_cmo(cmo3);
                     38:
                     39:   asir_ox_push_cmd(SM_executeFunction);  /* execute function */
                     40:
1.2       takayama   41:   size = asir_ox_peek_cmo_size();
                     42:   if (size < 1024) {
                     43:        asir_ox_pop_cmo(cmo, size);
                     44:   }else{
                     45:        fprintf(stderr,"Too big cmo size.\n"); exit(1);
                     46:   }
1.1       takayama   47:
1.2       takayama   48:   printf("gcd of 12 and 8, in the cmo format, is \n");
                     49:   for (i=0; i<size; i++) {
1.1       takayama   50:        printf(" %2x ",cmo[i]);
                     51:   }
                     52:   printf("\n");
                     53: }
                     54:
                     55:

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