--- /dev/null
+/* Roast+ License v1.0
+
+// ### C compilable ###
+*/
+#include <stdio.h>
+#include <string.h>
+
+__ROAST_EXTERN_C_START
+
+/* roast_strccpy */
+void roast_console_stick_turning(int turn_sleep, int count, const int* end_flag)
+{
+ int i;
+ for(i=0; i<4*count; i++)
+ {
+ if ( end_flag != NULL && *end_flag )
+ break;
+ switch(i%4)
+ {
+ case 0:
+ printf("|\b"); break;
+ case 1:
+ printf("/\b"); break;
+ case 2:
+ printf("-\b"); break;
+ case 3:
+ printf("\\\b"); break;
+ }
+ Sleep(turn_sleep);
+ }
+}
+
+void roast_console_print_progress_bar(char c, int length, int percent)
+{
+ int i;
+ for(i=0; i<length; i++)
+ {
+ if ( i <= length * percent / 100 )
+ putc(c, stdout);
+ else
+ putc(' ', stdout);
+ }
+}
+
+void roast_console_progress_bar(const char* head_out, const char* tail_out, char c, int length, const int* percent_ptr, int sleep_time)
+{
+ for(;;)
+ {
+ printf("\r");
+ printf(head_out);
+ roast_console_print_progress_bar('#', 30, *percent_ptr);
+ printf(tail_out);
+
+ if ( *percent_ptr == 100 ){
+ printf("\n");
+ break;
+ }
+
+ Sleep(sleep_time);
+ }
+}
+
+void roast_memdump(const void* mem, size_t length, size_t width, int flags)
+{
+ const unsigned char* p;
+ size_t i;
+ const char* p_ascii_print;
+
+ p = (const unsigned char*)mem;
+
+ printf(" ");
+ for(i=0; i<width; i++)
+ {
+ printf("%02X ", i);
+ }
+ printf("\n---------------------------------------------------------\n");
+
+ for(i=0; i<length; i++)
+ {
+ if ( i%width == 0 )
+ printf("%08X: ");
+
+ printf("%02X ", p[i]);
+
+ if ( i%width == width-1 || i == length-1 )
+ {
+ p_ascii_print = (const char*)(p - (i%width));
+ printf("| %s\n", p_ascii_print);
+ }
+ }
+}
+
+__ROAST_EXTERN_C_END