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