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 int myfrewind(FILE *fp);
00079
00080
00081 void mybmalloc_set_param();
00082 void *mybmalloc(int);
00083 void mybmalloc_free(void);
00084 char *mybstrdup(char *);
00085 void *mybmalloc2(int size, BMALLOC_BASE **list);
00086 char *mybstrdup2(char *, BMALLOC_BASE **list);
00087 void mybfree2(BMALLOC_BASE **list);
00088
00089
00090 void *mymalloc(int);
00091 void *myrealloc(void *, int);
00092 void *mycalloc(int, int);
00093
00094
00095 void swap_sample_bytes(SP16 *buf, int len);
00096 void swap_bytes(char *buf, size_t unitbyte, int unitnum);
00097
00098
00099 #include <stdarg.h>
00100 #ifdef CHARACTER_CONVERSION
00101 boolean j_printf_set_charconv(char *fromcode, char *tocode);
00102 char *charconv(char *instr, char *outstr, int maxoutlen);
00103 #ifdef HAVE_ICONV
00104 boolean charconv_iconv_setup(char *fromcode, char *tocode, boolean *enabled);
00105 char *charconv_iconv(char *instr, char *outstr, int maxoutlen);
00106 #endif
00107 #ifdef USE_WIN32_MULTIBYTE
00108 boolean charconv_win32_setup(char *fromcode, char *tocode, boolean *enabled);
00109 char *charconv_win32(char *instr, char *outstr, int maxoutlen);
00110 #endif
00111 #ifdef USE_LIBJCODE
00112 boolean charconv_libjcode_setup(char *fromcode, char *tocode, boolean *enabled);
00113 char *charconv_libjcode(char *instr, char *outstr, int maxoutlen);
00114 #endif
00115 #endif
00116 void set_print_func(void (*print)(char *), void (*printerr)(char *), void (*flush)(void));
00117 int j_printf(char *format, ...);
00118 int j_printerr(char *format, ...);
00119 int j_flushprint();
00120 int module_send(int sd, char *format, ...);
00121 void j_error(char *format, ...);
00122 void j_error_register_exitfunc(void (*error_func)());
00123 void j_exit();
00124 void j_exit_register_exitfunc(void (*exit_func)());
00125
00126
00127 char *mystrtok_quotation(char *str, char *delim, int left_paren, int right_paren, int mode);
00128 char *mystrtok_quote(char *str, char *delim);
00129 char *mystrtok(char *str, char *delim);
00130 char *mystrtok_movetonext(char *str, char *delim);
00131
00132
00133 void confout(FILE *strm);
00134 void confout_version(FILE *strm);
00135 void confout_audio(FILE *strm);
00136 void confout_lm(FILE *strm);
00137 void confout_am(FILE *strm);
00138 void confout_lib(FILE *strm);
00139 void confout_process(FILE *strm);
00140
00141 #endif