Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
utils.h
1 /*
2  * Open Chinese Convert
3  *
4  * Copyright 2010-2013 BYVoid <byvoid@byvoid.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __OPENCC_UTILS_H_
20 #define __OPENCC_UTILS_H_
21 
22 #include "common.h"
23 
24 #define debug_should_not_be_here() \
25  do { \
26  fprintf(stderr, "Should not be here %s: %d\n", __FILE__, __LINE__); \
27  assert(0); \
28  } while (0) \
29 
30 void perr(const char* str);
31 
32 int qsort_int_cmp(const void* a, const void* b);
33 
34 char* mstrcpy(const char* str);
35 
36 char* mstrncpy(const char* str, size_t n);
37 
38 void skip_utf8_bom(FILE* fp);
39 
40 const char* executable_path(void);
41 
42 char* try_open_file(const char* path);
43 
44 char* get_file_path(const char* filename);
45 
46 int is_absolute_path(const char* path);
47 
48 #endif /* __OPENCC_UTILS_H_ */