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