33 #include "libdemo_xc.h" 53 if (out_str !=
NULL) {
73 in->b_addr, in->b_nob);
112 f = fmemopen(
p, len,
"r");
124 if (fscanf(
f,
"%lf %n", &
val, &
n) < 1) {
129 res.mr_lbuf.b_addr =
p;
130 res.mr_lbuf.b_nob =
n;
134 if (fscanf(
f,
"%lf ", &
val) < 1)
139 for (
i = 2; fscanf(
f,
"%lf %n", &
val, &
n) > 0 && !feof(
f);
i++) {
160 res.mr_rbuf.b_addr =
p + ftell(
f) -
n;
161 res.mr_rbuf.b_nob =
n;
164 &
buf.b_addr, &
buf.b_nob) ?:
195 data->icp_data = stio;
237 *comp_data,
int *
rc))
245 fprintf(stderr,
"Computation already exists");
246 else if (
rc == -ENOMEM)
247 fprintf(stderr,
"Out of memory");
255 m0_xc_iscservice_demo_libdemo_init();
M0_INTERNAL int m0_buf_copy_aligned(struct m0_buf *dst, const struct m0_buf *src, unsigned shift)
static struct m0_addb2_philter p
void isc_fid_get(const char *f_name, struct m0_fid *fid)
M0_INTERNAL bool m0_buf_streq(const struct m0_buf *buf, const char *str)
#define M0_LOG(level,...)
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
int compute_minmax(enum op op, struct m0_isc_comp_private *pdata, struct m0_buf *out, int *rc)
static bool is_valid_string(struct m0_buf *in)
#define M0_ERR_INFO(rc, fmt,...)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL int64_t m0_isc_io_res(struct m0_stob_io *stio, char **buf)
int comp_min(struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
int comp_max(struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
M0_INTERNAL int m0_xcode_obj_enc_to_buf(struct m0_xcode_obj *obj, void **buf, m0_bcount_t *len)
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
M0_INTERNAL void m0_isc_io_fini(struct m0_stob_io *stio)
static void comp_reg(const char *f_name, int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc))
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL int m0_xcode_obj_dec_from_buf(struct m0_xcode_obj *obj, void *buf, m0_bcount_t len)
int launch_io(struct m0_isc_comp_private *pdata, struct m0_buf *in, int *rc)
int hello_world(struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
int do_minmax(enum op op, struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *data, int *rc)
#define M0_XCODE_OBJ(type, ptr)
M0_INTERNAL int m0_isc_comp_register(int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc), const char *f_name, const struct m0_fid *ftn_fid)
M0_INTERNAL int m0_isc_io_launch(struct m0_stob_io *stio, struct m0_fid *cob, struct m0_io_indexvec *iv, struct m0_fom *fom)