Waitrud Weber’s blog

things and reminders for memories

C_Analyzer: We can have a lot of controls, skipping the under control as a canread.

We don't think, the below is too bad, we can control seperations as well as switch.

main.cpp  Tue Jul 06 14:32:29 2021
...
370 :		if ( canread == 1 && m_start_with ( (char*)p_dummy, "\r\n" ) == 1 && level == 1 ) {
371 :			printf("we could find line end.\r\n");
372 :			clear_token();
373 :			i++;
374 :			canread = 2;
375 :			sleep(2);
376 :		} else if (canread == 1 &&  m_start_with ( (char*)p_dummy, "#define" ) == 1 && level == 1  ) {
377 :			printf("we could find #define.\r\n");
378 :			clear_token();
379 :			sleep(2);
380 :		} else if ( canread == 1 && m_start_with ( (char*)p_dummy, "\r\n" ) == 1 && level == 0  ) {
381 :			printf("we could find line-end as unread.\r\n");
382 :			level = 1;
383 :			clear_token();
384 :			canread = 2;
385 :			sleep(2);
386 :		} else if ( canread == 1 && m_start_with ( (char*)p_dummy, "#include" ) == 1 && level == 1 ) {
387 :			printf("we could find #include.\r\n");
388 :			level = 1;
389 :			clear_token();
390 :			canread = 2;
391 :			sleep(2);
392 :		} else if ( canread == 1 && m_start_with ( (char*)p_dummy, "typedef" ) == 1 && level == 1 ) {
393 :			printf("we could find typedef.\r\n");
394 :			level = 10;
395 :			canread = 2;
396 :			sleep(2);
397 :		} else if ( canread == 1 && typeofprimitive ( &structure_fp, (char*)p_dummy ) == 1 && level == 1 ) {
398 :			printf(" we could find type.\r\n");
399 :			level = 2;
400 :			i++;
401 :			canread = 2;
402 :			sleep(2);
403 :		} else if ( canread == 1 && typedef_keywords ( &structure_fp, (char*)p_dummy ) == 1 && level == 10 ) {
404 :			printf(" we could find typedeff keyword.\r\n");
405 :			level = 2;
406 :			i++;
407 :			canread = 2;
408 :			sleep(2);
409 :			exit(-1);
410 :		} else if ( canread == 1 && m_start_with ( (char*)p_dummy, ";" ) == 1 && level == 2 ) {
411 :			printf("Error: we could find semi-coon of line end.\r\n");
412 :			printf("p_dummy_token %s p_dummy %s", p_dummy_token, p_dummy );
413 :			sleep(2);
414 :			canread = 2;
415 :			exit(-1);
416 :		}

--- execution 001 ---
typedef_keywords canread 1
i: 141 loop starts. level 1
struct_fp.fp |2003541096|
get_char starts.
struct_fp.fp |2003541096| struct_fp.index |141|
struct_fp.fp |2003541096|
get_char ends.
typeofprimitive canread 1
typedef_keywords canread 1
i: 142 loop starts. level 1
struct_fp.fp |2003541096|
get_char starts.
struct_fp.fp |2003541096| struct_fp.index |142|
struct_fp.fp |2003541096|
get_char ends.
typeofprimitive canread 1
typedef_keywords canread 1
i: 143 loop starts. level 1
struct_fp.fp |2003541096|
get_char starts.
struct_fp.fp |2003541096| struct_fp.index |143|
struct_fp.fp |2003541096|
get_char ends.
typeofprimitive canread 1
we could find struct.
--- execution 001 ---