#include static void *scc_ap_alloc(size_t size) { void *p = SCC_AP_MALLOC(size); SCC_AP_ASSERT(p != NULL); return p; } /* 重新分配内存 */ static void *scc_ap_realloc_data(void *old, size_t new_size) { void *p = SCC_AP_REALLOC(old, new_size); SCC_AP_ASSERT(p != NULL); return p; } void scc_ap_drop(scc_ap_t *ap) { SCC_AP_ASSERT(ap); // SCC_AP_FREE(ap->data); scc_ap_init(ap); } void scc_ap_with_bits(scc_ap_t *ap, int bits) {} void scc_ap_from_string(scc_ap_t *ap, const char *str, int len, int base) { SCC_AP_ASSERT(base == 10); SCC_AP_ASSERT(ap && str); if (len == 0) { scc_ap_set_int(ap, 0); } // FIXME int int_lit = 0; for (int i = 0; i < len; i += 1) { int_lit = int_lit * 10 + (str[i] - '0'); } scc_ap_set_int(ap, int_lit); } void scc_ap_set_digit(scc_ap_t *ap, scc_ap_digit digit) {} void scc_ap_add_impl(scc_ap_t *to, const scc_ap_t *from_a, const scc_ap_t *from_b) {} void scc_ap_add(scc_ap_t *to, const scc_ap_t *from_a, const scc_ap_t *from_b) {} void scc_ap_sub(scc_ap_t *to, const scc_ap_t *from_a, const scc_ap_t *from_b) {} typedef void (*ap_dump_fn)(const char ch, void *user_data); int scc_ap_dump(scc_ap_t *ap, ap_dump_fn dump_fn, void *user_data) { return 0; }