Cantera  2.1.2
tok_input_util.h
1 #ifndef TOK_INPUT_UTIL_H
2 #define TOK_INPUT_UTIL_H
3 
4 #include "stdio.h"
5 
6 #ifndef MAX_INPUT_STR_LN
7 #define MAX_INPUT_STR_LN 16100
8 #endif
9 #ifndef MAX_TOKEN_STR_LN
10 #define MAX_TOKEN_STR_LN 255
11 #endif
12 #ifndef MAXTOKENS
13 #define MAXTOKENS 20
14 #endif
15 
16 /**************************************************************************/
17 /* TOKEN structure:
18  * This structure is used to parse strings. The original string is
19  * tokenized into a set of tokens via separation wrt white space.
20  * Both the tokens and the original
21  * string are stored within the structure
22  */
23 
24 struct TOKEN {
25  char* orig_str;
26  char* tok_str;
27  char* tok_ptr[MAXTOKENS];
28  int ntokes;
29  TOKEN(void);
30  ~TOKEN();
31  TOKEN(const char* str);
32 };
33 
34 
35 #define NO_DEFAULT_INT -68361
36 #define NO_DEFAULT_BOOLEAN NO_DEFAULT_INT
37 #define NO_DEFAULT_DOUBLE -1.241E+11
38 #define NO_DEFAULT_STR "NO_DEFAULT"
39 
40 
41 /**************************************************************************/
42 /* Prototypes for routines tok_input_util.c */
43 /**************************************************************************/
44 
45 extern bool get_next_keyLine(FILE*, TOKEN*, TOKEN*);
46 extern int tok_to_int(const TOKEN*, const int, const int,
47  const int, bool*);
48 extern int str_to_int(const char*, const int, const int,
49  const int, bool*);
50 extern double tok_to_double(const TOKEN*, const double, const double,
51  const double, bool*);
52 extern double str_to_double(const char*, const double, const double,
53  const double, bool*);
54 extern bool tok_to_boolean(const TOKEN*, const int, bool*);
55 extern bool str_to_boolean(const char*, const int, bool*);
56 extern char* tok_to_string(const TOKEN*, const int, const int,
57  const char*, bool*);
58 extern char* str_to_string(const char*, const char*, bool*);
59 extern int scan_for_int(FILE*, const char*, const int, const int);
60 extern double scan_for_double(FILE*, const char*, const double,
61  const double);
62 extern char* scan_for_string(FILE*, const char*, const int, const int);
63 extern bool scan_for_boolean(FILE*, const char*);
64 extern int scan_for_line(FILE*, const char*, char [], const char,
65  const int);
66 extern int read_line(FILE*, char [], const int);
67 extern int read_string(FILE*, char [], const char);
68 extern int strip(char []);
69 extern void lower_case(char []);
70 extern char* TokToStrng(const TOKEN*);
71 extern int stokenize(char*, const char*, char *[], const int);
72 extern bool strmatch(const char*, const char*);
73 extern bool strstrmatch(const char*, const char*);
74 extern bool strtokmatch(const TOKEN*, const char*);
75 extern bool toktokmatch(const TOKEN*, const TOKEN*);
76 extern void fillTokStruct(TOKEN*, const char*);
77 extern void copyTokStruct(TOKEN*, const TOKEN*);
78 extern int in_char_list(const char* const, const char** const, int);
79 extern char* copy_string(const char*);
80 extern void strip_item_from_token(int, TOKEN*);
81 /**************************************************************************/
82 #endif /* END OF TOK_INPUT_UTIL_H */
83 /**************************************************************************/
84