version 1.4.56b
[polyglot.git] / util.h
diff --git a/util.h b/util.h
index 2b0886c..3855a82 100644 (file)
--- a/util.h
+++ b/util.h
@@ -7,6 +7,9 @@
 // includes\r
 \r
 #include <stdio.h>\r
+#include <sys/types.h>\r
+#include <sys/timeb.h>\r
+#include <sys/stat.h>\r
 \r
 // defines\r
 \r
 \r
 #define FormatBufferSize 4096\r
 \r
+#ifdef _MSC_VER\r
+#define vsnprintf _vsnprintf\r
+#endif\r
+\r
 #define CONSTRUCT_ARG_STRING(format,buf)                                 \\r
     {                                                                    \\r
         va_list arg_list;                                                \\r
                           format,                                        \\r
                           arg_list);                                     \\r
         va_end(arg_list);                                                \\r
-        buf[sizeof(buf)]='\0';                                           \\r
+        buf[sizeof(buf)-1]='\0';                                         \\r
         if(written>=sizeof(buf) || written<0){                           \\r
            my_fatal("write_buffer overflow: file \"%s\", line %d\n",     \\r
                    __FILE__,__LINE__);                                   \\r
         }                                                                \\r
     }                                                                    \\r
 \r
+#define TO_BOOL(string) ((my_string_case_equal(string,"false") ||   \\r
+                          my_string_equal(string,"0"))?FALSE:TRUE)\r
+\r
+#define IS_BOOL(string) (my_string_case_equal(string,"false")||     \\r
+                         my_string_case_equal(string,"true") ||     \\r
+                         my_string_case_equal(string,"1")    ||     \\r
+                         my_string_case_equal(string,"0"))\r
 // types\r
 \r
 typedef signed char sint8;\r
@@ -135,11 +149,20 @@ extern void   my_log                (const char format[], ...);
 extern void   my_fatal              (const char format[], ...);\r
 \r
 extern bool   my_file_read_line     (FILE * file, char string[], int size);\r
+extern void   my_path_join          (char *join_path, const char *path, const char *file);\r
+\r
+extern int    my_mkdir              (const char *path);\r
 \r
 extern bool   my_string_empty       (const char string[]);\r
 extern bool   my_string_whitespace  (const char string[]);\r
 extern bool   my_string_equal       (const char string_1[], const char string_2[]);\r
 extern bool   my_string_case_equal  (const char string_1[], const char string_2[]);\r
+extern const char* my_string_case_contains(const char haystack[], \r
+                                          const char needle[]);\r
+\r
+\r
+extern bool   my_string_to_lower    (char dst[], const char src[]);\r
+\r
 extern char * my_strdup             (const char string[]);\r
 \r
 extern void   my_string_clear       (const char * * variable);\r
@@ -155,6 +178,15 @@ extern double my_timer_elapsed_real (const my_timer_t * timer);
 \r
 extern char * my_error();\r
 \r
+extern void my_dequote              (char *out, \r
+                                    const char *in, \r
+                                    const char *special);\r
+extern void my_quote                (char *out, \r
+                                    const char *in, \r
+                                    const char *special);\r
+\r
+extern void my_sleep                (int msec);\r
+\r
 #endif // !defined UTIL_H\r
 \r
 // end of util.h\r