int cl_print(sVMInfo* info, char* msg, ...) { char* msg2; int n; va_list args; va_start(args, msg); n = vasprintf(ALLOC &msg2, msg, args); va_end(args); if(info->print_buffer) { // this is hook of all clover output sBuf_append(info->print_buffer, msg2, n); } else { printf("%s", msg2); fflush(stdout); //write(1, msg2, strlen(msg2)); } free(msg2); return n; }
void sBuf_append_int(sBuf* self, int value) { sBuf_append(self, &value, sizeof(int)); }
void sBuf_append_long(sBuf* self, long long value) { sBuf_append(self, &value, sizeof(long long)); }
void sBuf_append_str(sBuf* self, char* str) { sBuf_append(self, str, strlen(str)); }