version 1.1, 1999/12/16 06:09:42 |
version 1.5, 2003/02/04 20:43:55 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/sample1.c,v 1.4 2003/01/11 11:42:32 ohara Exp $ */ |
|
|
/* |
/* |
This sample program explains how to construct |
This sample program explains how to construct |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <unistd.h> |
#include <unistd.h> |
#include "ox.h" |
#include "ox_toolkit.h" |
|
|
/* This program uses High-level functions of OpenXM C library. */ |
/* This program uses High-level functions of OpenXM C library. */ |
int main() |
int main() |
{ |
{ |
ox_file_t s; |
OXFILE *s; |
cmo_list *c; |
cmo_list *c; |
|
|
/* starting an OpenXM server */ |
ox_stderr_init(stderr); |
|
/* starting an OpenXM server */ |
s = ox_start("localhost", "ox", "ox_sm1"); |
s = ox_start("localhost", "ox", "ox_sm1"); |
|
|
ox_push_cmo(s, (cmo *)new_cmo_int32(32)); |
ox_push_cmo(s, (cmo *)new_cmo_int32(32)); |
ox_push_cmo(s, (cmo *)new_cmo_string("Hello")); |
ox_push_cmo(s, (cmo *)new_cmo_string("Hello")); |
|
|
/* making a list {10000, -2342, 3141592653289793238462643383279}. |
/* making a list {10000, -2342, 3141592653289793238462643383279}. |
the elements are a bignum. */ |
the elements are a bignum. */ |
c = new_cmo_list(); |
c = new_cmo_list(); |
|
|
append_cmo_list(c, new_cmo_zz_set_si(10000)); |
list_append(c, new_cmo_zz_set_si(10000)); |
append_cmo_list(c, new_cmo_zz_set_si(-2342)); |
list_append(c, new_cmo_zz_set_si(-2342)); |
append_cmo_list(c, new_cmo_zz_set_string("3141592653289793238462643383279")); |
list_append(c, new_cmo_zz_set_string("3141592653289793238462643383279")); |
|
|
/* sending the list above. */ |
/* sending the list above. */ |
ox_push_cmo(s, (cmo *)c); |
ox_push_cmo(s, (cmo *)c); |
|
|
ox_push_cmd(s, SM_popCMO); |
ox_push_cmd(s, SM_popCMO); |
ox_push_cmd(s, SM_popCMO); |
ox_push_cmd(s, SM_popCMO); |
ox_push_cmd(s, SM_popCMO); |
ox_push_cmd(s, SM_popCMO); |
|
|
ox_close(s); |
ox_close(s); |
return 0; |
return 0; |