00001
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __SENT_UTIL_H__
00034 #define __SENT_UTIL_H__
00035
00036
00037
00038
00049 #define MYBMALLOC_BLOCK_SIZE 10000
00050
00052 typedef struct _bmalloc_base {
00053 void *base;
00054 char *now;
00055 char *end;
00056 struct _bmalloc_base *next;
00057 } BMALLOC_BASE;
00058
00059
00060 char *getl(char *, int, FILE *);
00061 char *getl_fp(char *, int, FILE *);
00062 char *getl_fd(char *, int, int);
00063 char *getl_sd(char *, int, int);
00064 char *first_token(char *);
00065 char *next_token(void);
00066 char *next_token_if_any(void);
00067 char *rest_token(void);
00068
00069
00070 FILE *fopen_readfile(char *);
00071 int fclose_readfile(FILE *);
00072 FILE *fopen_writefile(char *);
00073 int fclose_writefile(FILE *);
00074 size_t myfread(void *ptr, size_t size, size_t n, FILE *fp);
00075 size_t myfwrite(void *ptr, size_t size, size_t n, FILE *fp);
00076 int myfgetc(FILE *fp);
00077 int myfeof(FILE *fp);
00078
00079
00080 void mybmalloc_set_param();
00081 void *mybmalloc(int);
00082 void mybmalloc_free(void);
00083 char *mybstrdup(char *);
00084 void *mybmalloc2(int size, BMALLOC_BASE **list);
00085 void mybfree2(BMALLOC_BASE **list);
00086
00087
00088 void *mymalloc(int);
00089 void *myrealloc(void *, int);
00090 void *mycalloc(int, int);
00091
00092
00093 void swap_sample_bytes(SP16 *buf, int len);
00094 void swap_bytes(char *buf, size_t unitbyte, int unitnum);
00095
00096
00097 #include <stdarg.h>
00098 #ifdef CHARACTER_CONVERSION
00099 boolean j_printf_set_charconv(char *fromcode, char *tocode);
00100 char *charconv(char *instr, char *outstr, int maxoutlen);
00101 #ifdef HAVE_ICONV
00102 boolean charconv_iconv_setup(char *fromcode, char *tocode, boolean *enabled);
00103 char *charconv_iconv(char *instr, char *outstr, int maxoutlen);
00104 #endif
00105 #ifdef USE_WIN32_MULTIBYTE
00106 boolean charconv_win32_setup(char *fromcode, char *tocode, boolean *enabled);
00107 char *charconv_win32(char *instr, char *outstr, int maxoutlen);
00108 #endif
00109 #ifdef USE_LIBJCODE
00110 boolean charconv_libjcode_setup(char *fromcode, char *tocode, boolean *enabled);
00111 char *charconv_libjcode(char *instr, char *outstr, int maxoutlen);
00112 #endif
00113 #endif
00114 void set_print_func(void (*print)(char *), void (*printerr)(char *), void (*flush)(void));
00115 int j_printf(char *format, ...);
00116 int j_printerr(char *format, ...);
00117 int j_flushprint();
00118 int module_send(int sd, char *format, ...);
00119 void j_error(char *format, ...);
00120 void j_error_register_exitfunc(void (*error_func)());
00121 void j_exit();
00122 void j_exit_register_exitfunc(void (*exit_func)());
00123
00124
00125 char *mystrtok_quotation(char *str, char *delim, int left_paren, int right_paren, int mode);
00126 char *mystrtok_quote(char *str, char *delim);
00127 char *mystrtok(char *str, char *delim);
00128 char *mystrtok_movetonext(char *str, char *delim);
00129
00130 #endif