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