OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
analyse_check.h File Reference
#include "analyse_comment.h"

Go to the source code of this file.

Data Structures

struct  analyse_check_group_s
struct  analyse_check_s

Typedefs

typedef struct analyse_check_group_s analyse_check_group_t
typedef struct analyse_check_s analyse_check_t

Functions

void analyse_check_store (analyse_check_t *check_list, int language, int check_id)
void analyse_check_file_read (analyse_check_t **check_p, analyse_check_group_t **check_group_p, char *error_filename)
void analyse_check_file_write (analyse_check_t *check_list, analyse_check_group_t *check_group_list, int language)
void analyse_check_clean_memory (analyse_check_t *check_list, analyse_check_group_t *check_group_list)

Typedef Documentation

◆ analyse_check_group_t

◆ analyse_check_t

Function Documentation

◆ analyse_check_clean_memory()

void analyse_check_clean_memory ( analyse_check_t * check_list,
analyse_check_group_t * check_group_list )

Definition at line 372 of file analyse_check.c.

373{
374
375
376}

◆ analyse_check_file_read()

void analyse_check_file_read ( analyse_check_t ** check_p,
analyse_check_group_t ** check_group_p,
char * error_filename )

Definition at line 152 of file analyse_check.c.

153{
154 FILE *infile=NULL;
155 char line[ANALYSE_SIZE_OF_LINE];
156 char key[ANALYSE_SIZE_OF_LINE];
157 int i, id;
158 int linecount = 0;
159
160 analyse_comment_t *comment;
161
162 analyse_check_t *work_check;
163 analyse_check_t tmp_check;
164
165 analyse_check_group_t *work_check_group;
166 analyse_check_group_t tmp_check_group;
167
168 int count_check_group = 0;
169 int check_group_already_print = 0;
170
171 int count_check = 0;
172 int check_already_print = 0;
173
174 int nb_check, nb_check_group, size, size2;
175 int *tab, *tab2;
176
177 int nb_elt;
178 int *elt;
179
180 /*************/
181 /* Open File */
182 /*************/
183 if (infilename != NULL)
184 {
185 infile = fopen(infilename,"r");
186 }
187
188 if (infile == NULL)
189 {
190 Analyse_Print_Debug("\nNo Check File Found. Use Default\n\n");
191
192
193 return;
194 }
195
196
197 /***************************/
198 /* Allocate Message Memory */
199 /***************************/
200
201 /* Count message */
202 analyse_count_check(line, infile, infilename, &linecount, &nb_check, &nb_check_group);
203 rewind(infile);
204 analyse_stack_check(line, infile, infilename, &linecount, &nb_check_group, &size, &tab, &nb_check, &size2, &tab2 );
205
206 ANALYSE_NB_CHECK_GROUP = nb_check_group;
207 ANALYSE_NB_CHECK = nb_check;
208
209 analyse_free(tab);
210 analyse_free(tab2);
211
212 *check_p = check_create(ANALYSE_NB_CHECK);
214
215
216 /****************/
217 /* Read Message */
218 /****************/
219 rewind(infile);
220 while ( ( analyse_getline(line, infile, infilename, &linecount) != -1) &&
221 ( strncmp(line, "/END", 4) != 0 ))
222 {
223 if (strstr(line, "/ANALYSE/CHECK/GROUP") != NULL)
224 {
225 /* Search Group id */
226 analyse_getkey(4 , line, key);
227 sscanf(key, "%d", &id );
228
229 /* Search id */
230 tmp_check_group.id = id;
231 work_check_group = bsearch( &tmp_check_group, *check_group_p, ANALYSE_NB_CHECK_GROUP, sizeof(analyse_check_group_t), compar_check_group);
232
233 if ( work_check_group == NULL)
234 {
235 if (count_check_group >= ANALYSE_NB_CHECK_GROUP)
236 {
237 if ( check_group_already_print == 0)
238 {
239 Analyse_Print_Error_Level("\n\n*** Analyse Internal Error (ANALYSE_NB_CHECK_GROUP) : Too Many Messages \n\n", 2);
240 check_group_already_print = 1;
241 }
242 continue;
243 }
244
245 work_check_group = *check_group_p + count_check_group;
246
247 work_check_group->order = count_check_group;
248 work_check_group->id = id;
249
250 /* Note : if file order is in id increase, this qsort does nothing ... */
252 tmp_check_group.id = id;
253 /* .. and this bsearch gives the same work_group */
254 work_check_group = bsearch( &tmp_check_group, *check_group_p, ANALYSE_NB_CHECK_GROUP, sizeof(analyse_check_group_t), compar_check_group);
255
256 count_check_group++;
257 }
258
259 analyse_getkey(5 , line, key);
260
261 if (strncmp(key, "TITLE", 5) == 0)
262 {
263 /* Read Comment */
264 comment = analyse_read_comment(line, infile, infilename, &linecount);
265 analyse_add_comment(ANALYSE_CHECK_GROUP, (void *)work_check_group, comment);
266 }
267 else if (strncmp(key, "DESCRIPTION", 5) == 0)
268 {
269 /* Read list of ids */
270 if ( analyse_getlist_of_int(&nb_elt, &elt, infile, infilename, &linecount) == 0)
271 {
272 work_check_group->check_list = (int *)analyse_realloc(work_check_group->check_list, (work_check_group->nb_check + nb_elt)*sizeof(int));
273 work_check_group->check_message = (char **)analyse_realloc(work_check_group->check_message, (work_check_group->nb_check + nb_elt)*sizeof(char *));
274
275 for(i=0; i<nb_elt; i++)
276 {
277 work_check_group->check_list[work_check_group->nb_check + i] = elt[i];
278 work_check_group->check_message[work_check_group->nb_check + i] = NULL;
279 }
280 analyse_free(elt);
281 work_check_group->nb_check = work_check_group->nb_check + nb_elt;
282 }
283 }
284 }
285 else if (strstr(line, "/ANALYSE/CHECK") != NULL)
286 {
287 analyse_getkey(3 , line, key);
288 sscanf(key, "%d", &id );
289
290 /* Search id */
291 tmp_check.id = id;
292 work_check = bsearch( &tmp_check, *check_p, ANALYSE_NB_CHECK, sizeof(analyse_check_t), compar_check);
293
294 if ( work_check == NULL)
295 {
296 if (count_check >= ANALYSE_NB_CHECK)
297 {
298 if ( check_already_print == 0)
299 {
300 Analyse_Print_Error_Level("\n\n*** Analyse Internal Error (ANALYSE_NB_CHECK) : Too Many Messages \n\n", 2);
301 check_already_print = 1;
302 }
303 continue;
304 }
305
306 work_check = *check_p + count_check;
307 count_check++;
308
309 work_check->id = id;
310
311 /* Note : if file order is in id increase, this qsort does nothing ... */
313 tmp_check.id = id;
314 /* .. and this bsearch gives the same work_check */
315 work_check = bsearch( &tmp_check, *check_p, ANALYSE_NB_CHECK, sizeof(analyse_check_t), compar_check);
316
317 }
318
319 /* Read Comment */
320 comment = analyse_read_comment(line, infile, infilename, &linecount);
321 analyse_add_comment(ANALYSE_CHECK, (void *)work_check, comment);
322
323 }
324 }
325
326 fclose(infile);
327
328}
static int compar_check(const void *check_1_p, const void *check_2_p)
static int ANALYSE_NB_CHECK_GROUP
static analyse_check_group_t * check_group_create(int nb_check_group)
static analyse_check_t * check_create(int nb_check)
static int ANALYSE_NB_CHECK
static int compar_check_group(const void *group_1_p, const void *group_2_p)
struct analyse_check_group_s analyse_check_group_t
struct analyse_check_s analyse_check_t
void analyse_add_comment(int object_type, void *object, analyse_comment_t *comment)
struct analyse_comment_s analyse_comment_t
#define ANALYSE_CHECK
#define ANALYSE_CHECK_GROUP
#define ANALYSE_SIZE_OF_LINE
int analyse_getkey(int pos, char *line, char *name)
int analyse_getlist_of_int(int *nb_elt, int **elt, FILE *infile, char *infilename, int *linecount)
int analyse_getline(char line[], FILE *infile, char *infilename, int *linecount)
void analyse_free(void *block)
void * analyse_realloc(void *block, size_t size)
void Analyse_Print_Error_Level(char *text, int level)
void Analyse_Print_Debug(char *text)
void analyse_count_check(char *line, FILE *infile, char *infilename, int *linecount_p, int *cnt_check_p, int *cnt_group_p)
analyse_comment_t * analyse_read_comment(char *line, FILE *infile, char *filename, int *linecount_p)
void analyse_stack_check(char *line, FILE *infile, char *infilename, int *linecount_p, int *nb_check_group_p, int *size_p, int **tab_p, int *nb_check_p, int *size2_p, int **tab2_p)
recursive subroutine qsort(a, idx, first, last)
initmumps id

◆ analyse_check_file_write()

void analyse_check_file_write ( analyse_check_t * check_list,
analyse_check_group_t * check_group_list,
int language )

Definition at line 330 of file analyse_check.c.

331{
332 int i,j, nb_check;
333
334 analyse_comment_t *scan_comment;
335
336 analyse_check_group_t *work_check_group;
337
338 analyse_check_t tmp_check;
339 analyse_check_t *work_check;
340
341 /* re order groups by order appearance in file, and no more by id */
343
344 for (i=0; i<ANALYSE_NB_CHECK_GROUP; i++)
345 {
346 work_check_group = check_group_list+i;
347 nb_check = work_check_group->nb_check;
348
349 scan_comment = analyse_get_right_comment( work_check_group->title, language, ANALYSE_ENGLISH);
350
351 if ((scan_comment != NULL) && (scan_comment->text != NULL))
352 {
353 analyse_write_f("\n\n");
354 analyse_write_f(scan_comment->text);
355 /* analyse_write_f("\n"); */
356 }
357
358 for( j=0; j<nb_check; j++)
359 {
360 tmp_check.id = work_check_group->check_list[j];
361 work_check = bsearch( &tmp_check, check_list, ANALYSE_NB_CHECK, sizeof(analyse_check_t), compar_check);
362
363 if ((work_check != NULL) && (work_check->check_message!= NULL))
364 {
365 analyse_write_f(work_check->check_message);
366 /* analyse_write_f("\n"); */
367 }
368 }
369 }
370}
void analyse_write_f(char *message)
Definition analyse.c:1022
static int compar_check_group_by_order(const void *group_1_p, const void *group_2_p)
analyse_comment_t * analyse_get_right_comment(analyse_comment_t *start_comment, int language, int default_language)
#define ANALYSE_ENGLISH
analyse_comment_t * title

◆ analyse_check_store()

void analyse_check_store ( analyse_check_t * check_list,
int language,
int check_id )

Definition at line 118 of file analyse_check.c.

119{
120 analyse_comment_t *scan_comment;
121 analyse_check_t tmp_check;
122 analyse_check_t *work_check;
123
124 char line[ANALYSE_SIZE_OF_LINE];
125
126 /* Search id */
127 tmp_check.id = id;
128 work_check = bsearch( &tmp_check, check_list, ANALYSE_NB_CHECK, sizeof(analyse_check_t), compar_check);
129
130 if ( work_check == NULL)
131 {
132 sprintf(line, "Unknown Id for Check %d\nNo Message Available\n", id );
134 }
135
136 if ( work_check->check_message != NULL )
137 {
138 analyse_free(work_check->check_message);
139 work_check->check_message = NULL;
140 }
141
142 scan_comment = analyse_get_right_comment( work_check->title, language, ANALYSE_ENGLISH);
143
144 work_check->check_message = analyse_fill_description(AN_CHECK, scan_comment->text);
145
146}
char * analyse_fill_description(int object_type, char *description)
analyse_comment_t * title