OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
analyse_read_tools.h File Reference
#include <stdio.h>
#include "analyse_comment.h"

Go to the source code of this file.

Functions

int analyse_find_id (int size, int *tab, int id)
char * analyse_read_text (char *line, FILE *infile, char *filename, int *linecount_p)
char * analyse_read_text_default (char *line, FILE *infile, char *filename, int *linecount_p)
analyse_comment_tanalyse_read_comment (char *line, FILE *infile, char *filename, int *linecount_p)
void analyse_count_error (char *line, FILE *infile, char *infilename, int *linecount_p, int *cnt_p)
void analyse_count_check (char *line, FILE *infile, char *infilename, int *linecount_p, int *cnt_check_p, int *cnt_group_p)
void analyse_stack_error (char *line, FILE *infile, char *infilename, int *linecount_p, int *cnt_p, int *size_p, int **tab_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)

Function Documentation

◆ analyse_count_check()

void analyse_count_check ( char * line,
FILE * infile,
char * infilename,
int * linecount_p,
int * cnt_check_p,
int * cnt_group_p )

Definition at line 207 of file analyse_read_tools.c.

208{
209 *cnt_check_p = 0;
210 *cnt_group_p = 0;
211
212 while ( ( analyse_getline(line, infile, infilename, linecount_p) != -1) &&
213 ( strncmp(line, "/END", 4) != 0 ))
214 {
215 if (strstr(line, "/ANALYSE/CHECK/GROUP") != NULL)
216 {
217 (*cnt_group_p)++;
218 }
219 else if ( strstr(line, "/ANALYSE/CHECK/") != NULL)
220 {
221 (*cnt_check_p)++;
222 }
223 }
224}
int analyse_getline(char line[], FILE *infile, char *infilename, int *linecount)

◆ analyse_count_error()

void analyse_count_error ( char * line,
FILE * infile,
char * infilename,
int * linecount_p,
int * cnt_p )

Definition at line 194 of file analyse_read_tools.c.

195{
196 *cnt_p = 0;
197
198 while ( ( analyse_getline(line, infile, infilename, linecount_p) != -1) &&
199 ( strncmp(line, "/END", 4) != 0 ))
200 {
201 /*ls41l33 if (strstr(line, "/ANALYSE/ERROR/") != NULL) (*cnt_p)++;*/
202 if (strstr(line, "/ANALYSE/MESSAGE/") != NULL) (*cnt_p)++;
203 }
204}

◆ analyse_find_id()

int analyse_find_id ( int size,
int * tab,
int id )

Definition at line 66 of file analyse_read_tools.c.

67{
68 int keep_id, i, cnt;
69
70 keep_id = -1;
71 cnt = 0;
72
73 for(i=0; i<size; i++)
74 {
75 if (tab[i] != keep_id)
76 {
77 cnt++;
78 keep_id = tab[i];
79 }
80
81 if (tab[i] == id)
82 break;
83 }
84
85 return cnt;
86}

◆ analyse_read_comment()

analyse_comment_t * analyse_read_comment ( char * line,
FILE * infile,
char * filename,
int * linecount_p )

Definition at line 170 of file analyse_read_tools.c.

171{
172 analyse_comment_t *comment;
173
174 /* Read Comment */
176
177 if ( analyse_getline(line, infile, filename, linecount_p) == -1)
178 {
179 analyse_free(comment);
180 return NULL;
181 }
182
183 if (strncmp(line, "ENGLISH",7) == 0)
184 comment->language = ANALYSE_ENGLISH;
185 else
186 comment->language = -1;
187
188 comment->text = analyse_read_text(line, infile, filename, linecount_p);
189
190 return comment;
191}
struct analyse_comment_s analyse_comment_t
#define ANALYSE_ENGLISH
void * analyse_malloc(size_t size)
void analyse_free(void *block)
char * analyse_read_text(char *line, FILE *infile, char *filename, int *linecount_p)

◆ analyse_read_text()

char * analyse_read_text ( char * line,
FILE * infile,
char * filename,
int * linecount_p )

Definition at line 130 of file analyse_read_tools.c.

131{
132 int i;
133 int nb_line=0;
134 int nb_dataline=0;
135 char *text;
136
137 analyse_getsize_of_enum (&nb_line, &nb_dataline, infile, filename, linecount_p);
138
139 text = (char *)analyse_malloc((nb_dataline*(ANALYSE_SIZE_OF_LINE+1))*sizeof(char));
140 #ifdef _WIN64
141 strcpy_s(text, ANALYSE_SIZE_OF_LINE+1,"");
142 #else
143 strcpy(text, "");
144 #endif
145
146 for (i=0; i<nb_dataline; i++)
147 {
148 if ( analyse_getline(line, infile, filename, linecount_p) == -1)
149 {
150 analyse_free(text);
151 return NULL;
152 }
153
155 if (strlen(line) > 0)
156 {
157 #ifdef _WIN64
158 strcat_s(text,ANALYSE_SIZE_OF_LINE+1, line);
159 strcat_s(text,ANALYSE_SIZE_OF_LINE+1, "\n");
160 #else
161 strcat(text, line);
162 strcat(text, "\n");
163 #endif
164 }
165 }
166
167 return text;
168}
#define ANALYSE_SIZE_OF_LINE
int analyse_getsize_of_enum(int *nb_line, int *nb_dataline, FILE *infile, char *infilename, int *linecount)
char * analyse_string_fit_start_end(char *name)

◆ analyse_read_text_default()

char * analyse_read_text_default ( char * line,
FILE * infile,
char * filename,
int * linecount_p )

Definition at line 89 of file analyse_read_tools.c.

90{
91 int i;
92 int nb_line=0;
93 int nb_dataline=0;
94 char *text;
95
96 analyse_getsize_of_enum (&nb_line, &nb_dataline, infile, filename, linecount_p);
97
98 text = (char *)analyse_malloc((nb_dataline*(ANALYSE_SIZE_OF_LINE+1))*sizeof(char));
99#ifdef _WIN64
100 strcpy_s(text, ANALYSE_SIZE_OF_LINE+1,"");
101#else
102 strcpy(text, "");
103#endif
104 for (i=0; i<nb_dataline; i++)
105 {
106 if ( analyse_getline(line, infile, filename, linecount_p) == -1)
107 {
108 analyse_free(text);
109 return NULL;
110 }
111
113 if (strlen(line) > 0)
114 {
115 #ifdef _WIN64
116 strcat_s(text,ANALYSE_SIZE_OF_LINE+1, line);
117 strcat_s(text,ANALYSE_SIZE_OF_LINE+1, "\\n");
118 #else
119 strcat(text, line);
120 strcat(text, "\\n");
121 #endif
122 }
123 }
124
125 return text;
126}

◆ analyse_stack_check()

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 )

Definition at line 263 of file analyse_read_tools.c.

266{
267 char key[ANALYSE_SIZE_OF_LINE];
268 int nb_check, nb_check_group;
269
270 *size_p = *nb_check_group_p;
271 *size2_p = *nb_check_p;
272
273 *tab_p =(int*)analyse_malloc((*size_p)*sizeof(int));
274 *tab2_p =(int*)analyse_malloc((*size2_p)*sizeof(int));
275
276 nb_check_group = 0;
277 nb_check = 0;
278
279 while ( ( analyse_getline(line, infile, infilename, linecount_p) != -1) &&
280 ( strncmp(line, "/END", 4) != 0 ))
281 {
282 if (strstr(line, "/ANALYSE/CHECK/GROUP") != NULL)
283 {
284 analyse_getkey(4 , line, key);
285 #ifdef _WIN64
286 sscanf_s(key, "%d", *tab_p+nb_check_group );
287 #else
288 sscanf(key, "%d", *tab_p+nb_check_group );
289 #endif
290 nb_check_group++;
291 }
292 else if (strstr(line, "/ANALYSE/CHECK") != NULL)
293 {
294 analyse_getkey(3 , line, key);
295 #ifdef _WIN64
296 sscanf_s(key, "%d", *tab2_p+nb_check);
297 #else
298 sscanf(key, "%d", *tab2_p+nb_check);
299 #endif
300 nb_check ++;
301 }
302 }
303
304 /* sort Ids */
305 qsort(*tab_p, *size_p, sizeof(int), compar_int);
306 qsort(*tab2_p, *size2_p, sizeof(int), compar_int);
307
308 /* Cnt different id */
309 *nb_check_group_p = count_ids(*size_p, *tab_p);
310 *nb_check_p = count_ids(*size2_p, *tab2_p);
311
312}
int analyse_getkey(int pos, char *line, char *name)
static int count_ids(int size, int *tab)
static int compar_int(const void *int_1_p, const void *int_2_p)
recursive subroutine qsort(a, idx, first, last)

◆ analyse_stack_error()

void analyse_stack_error ( char * line,
FILE * infile,
char * infilename,
int * linecount_p,
int * cnt_p,
int * size_p,
int ** tab_p )

Definition at line 227 of file analyse_read_tools.c.

229{
230 char key[ANALYSE_SIZE_OF_LINE];
231 int step;
232
233 *size_p = *cnt_p;
234 *tab_p = (int*)analyse_malloc((*size_p)*sizeof(int));
235
236 step = 0;
237
238 while ( ( analyse_getline(line, infile, infilename, linecount_p) != -1) &&
239 ( strncmp(line, "/END", 4) != 0 ))
240 {
241 /* ls41l33 if (strstr(line, "/ANALYSE/ERROR/") != NULL) */
242 if (strstr(line, "/ANALYSE/MESSAGE/") != NULL)
243 {
244 analyse_getkey(3 , line, key);
245 #ifdef _WIN64
246 sscanf_s(key, "%d", *tab_p+ step );
247 #else
248 sscanf(key, "%d", *tab_p+ step );
249 #endif
250 step ++;
251 }
252 }
253
254 /* sort Ids */
255 qsort( *tab_p, *size_p, sizeof(int), compar_int);
256
257 /* Cnt different id */
258 *cnt_p = count_ids(*size_p, *tab_p);
259
260}