FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_ctrl_util.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
11 #ifndef fstr_ctrl_utilH
12 #define fstr_ctrl_utilH
13 
14 #include <assert.h>
15 #include <stdarg.h>
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include <string.h>
19 #include <ctype.h>
20 #include <hecmw_config.h>
21 
22 #ifndef HECMW_SERIAL
23 #include <hecmw_comm.h>
24 #endif
25 
26 #define FSTR_CTRL_RCODE_PARAM_SUCCESS 0
27 #define FSTR_CTRL_RCODE_PARAM_ERROR -1
28 #define FSTR_CTRL_RCODE_PARAM_TYPE_ERROR -2
29 #define FSTR_CTRL_RCODE_PARAM_RANGE_ERROR -3
30 #define FSTR_CTRL_RCODE_PARAM_NOTHING 1
31 #define FSTR_CTRL_RCODE_PARAM_VALUE_NOTHING 2
32 
33 #define FSTR_CTRL_RCODE_DATA_SUCCESS 0
34 #define FSTR_CTRL_RCODE_DATA_ERROR -1
35 #define FSTR_CTRL_RCODE_DATA_TYPE_ERROR -2
36 #define FSTR_CTRL_RCODE_DATA_RANGE_ERROR -3
37 #define FSTR_CTRL_RCODE_DATA_NOTHING 1
38 #define FSTR_CTRL_RCODE_DATA_LINE_NOTHING 2
39 
40 typedef struct st_ctrl_rec {
41  int line_no;
42  char* line;
44 
45 typedef struct st_fstr_ctrl_data {
47  int rec_n;
48  int* header_pos;
49  int header_n;
53 
54 /* ctrl list for fortran interface */
55 #define ctrl_list_size 20
56 #ifdef fstr_ctrl_util_MAIN
58 #else
60 #endif
61 
62 /* =================================================================================
63  */
69 void c_fstr_ctrl_get_err_msg(char* buff, size_t buff_size);
70 
71 /* =================================================================================
72  */
79 fstr_ctrl_data* c_fstr_ctrl_open(const char* filename);
80 
81 /* =================================================================================
82  */
90 
91 /* =================================================================================
92  */
101 int c_fstr_ctrl_get_line(fstr_ctrl_data* ctrl, int rec_no, char* buff,
102  size_t buff_size);
103 
104 /* =================================================================================
105  */
115 int c_fstr_ctrl_seek_header(fstr_ctrl_data* ctrl, const char* header_name);
116 
117 /* =================================================================================
118  */
126 
127 /* =================================================================================
128  */
137  char* header_name);
138 
139 /* =================================================================================
140  */
148 
149 /* =================================================================================
150  */
158 
159 /* =================================================================================
160  */
176 int c_fstr_ctrl_get_param(fstr_ctrl_data* ctrl, const char* param_name,
177  const char* value_list, char type, void* val);
178 
179 /* =================================================================================
180  */
198 int c_fstr_ctrl_get_param_ex(fstr_ctrl_data* ctrl, const char* param_name,
199  const char* value_list, int necessity, char type,
200  void* val);
201 
202 /* =================================================================================
203  */
211 
212 /* =================================================================================
213  */
214 /* JP-0 */
215 
217  char* data_line, size_t data_line_len);
218 
219 /* =================================================================================
220  */
221 /* JP-1 */
222 
224  const char* delim);
225 
226 /* =================================================================================
227  */
234 
236 
237 /* =================================================================================
238  */
239 /* JP-2 */
240 
241 int c_fstr_ctrl_get_data(fstr_ctrl_data* ctrl, int line_no, const char* format,
242  ...);
244  const char* format, va_list va);
246  const char* format, ...);
247 
248 int c_fstr_ctrl_get_data_array(fstr_ctrl_data* ctrl, const char* format, ...);
249 int c_fstr_ctrl_get_data_array_v(fstr_ctrl_data* ctrl, const char* format,
250  va_list va);
251 int c_fstr_ctrl_get_data_array_ex(fstr_ctrl_data* ctrl, const char* format,
252  ...);
253 
254 /* =================================================================================
255  */
263 
264 #endif
int line_no
struct st_fstr_ctrl_data fstr_ctrl_data
int c_fstr_ctrl_seek_next_header(fstr_ctrl_data *ctrl)
struct st_ctrl_rec ctrl_rec
int c_fstr_ctrl_get_rec_number(fstr_ctrl_data *ctrl)
int c_fstr_ctrl_get_current_header_name(fstr_ctrl_data *ctrl, char *header_name)
fstr_ctrl_data * ctrl_list[ctrl_list_size]
int c_fstr_ctrl_get_data_array_v(fstr_ctrl_data *ctrl, const char *format, va_list va)
int c_fstr_ctrl_close(fstr_ctrl_data *ctrl)
int c_fstr_ctrl_copy_data_line(fstr_ctrl_data *ctrl, int line_no, char *data_line, size_t data_line_len)
fstr_ctrl_data * c_fstr_ctrl_open(const char *filename)
int c_fstr_ctrl_get_data_array(fstr_ctrl_data *ctrl, const char *format,...)
int c_fstr_ctrl_get_param_ex(fstr_ctrl_data *ctrl, const char *param_name, const char *value_list, int necessity, char type, void *val)
int c_fstr_ctrl_seek_header(fstr_ctrl_data *ctrl, const char *header_name)
int c_fstr_ctrl_get_data_array_ex(fstr_ctrl_data *ctrl, const char *format,...)
#define ctrl_list_size
void c_fstr_ctrl_get_err_msg(char *buff, size_t buff_size)
int c_fstr_ctrl_get_data_line_n(fstr_ctrl_data *ctrl)
int c_fstr_ctrl_get_data_error_pos(void)
int c_fstr_ctrl_get_current_header_pos(fstr_ctrl_data *ctrl)
int c_fstr_ctrl_get_data_ex(fstr_ctrl_data *ctrl, int line_no, const char *format,...)
int c_fstr_ctrl_get_line(fstr_ctrl_data *ctrl, int rec_no, char *buff, size_t buff_size)
int c_fstr_ctrl_get_data_n_in_line(fstr_ctrl_data *ctrl, int line_no, const char *delim)
int c_fstr_ctrl_get_current_header_line_no(fstr_ctrl_data *ctrl)
int c_fstr_ctrl_get_data(fstr_ctrl_data *ctrl, int line_no, const char *format,...)
int c_fstr_ctrl_get_param(fstr_ctrl_data *ctrl, const char *param_name, const char *value_list, char type, void *val)
int c_fstr_ctrl_get_data_v(fstr_ctrl_data *ctrl, int line_no, const char *format, va_list va)
int c_fstr_ctrl_get_data_error_line(void)