int main(int argc, char* argv[]) { int s, d; int seq, dim; struct BOX* box; struct BOX boxes[30]; struct DIMENSION dimensions[30][10]; while (scanf("%d%d", &seq, &dim) == 2) { box = NULL; for (s = 0; s < seq; s++) { boxes[s].number = s + 1; boxes[s].count = 1; boxes[s].next = NULL; boxes[s].inside = NULL; boxes[s].dim = NULL; for (d = 0; d < dim; d++) { dimensions[s][d].next = NULL; scanf("%d", &dimensions[s][d].number); dimension_insert(&boxes[s].dim, &dimensions[s][d]); } box_insert(&box, &boxes[s]); } box_longest_nesting_string(box); } return 0; }
int foo(box_function_ctx_t *ctx, const char *args, const char *args_end) { static const char *SPACE_TEST_NAME = "test"; uint32_t space_test_id = box_space_id_by_name(SPACE_TEST_NAME, strlen(SPACE_TEST_NAME)); if (space_test_id == BOX_ID_NIL) { return box_error_set(__FILE__, __LINE__, ER_PROC_C, "Can't find space %s", SPACE_TEST_NAME); } char buf[16]; char *end = buf; end = mp_encode_array(end, 1); end = mp_encode_uint(end, 0); if (box_insert(space_test_id, buf, end, NULL) < 0) { return box_error_set(__FILE__, __LINE__, ER_PROC_C, "Can't insert in space %s", SPACE_TEST_NAME); } return 0; }