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