|
3 | 3 | #include <string.h> |
4 | 4 | #include <stdlib.h> |
5 | 5 |
|
6 | | -const char * yes[] = { "CH32V003" }; |
7 | | -const char * no[] = { "CH32V20x", "CH32V30x", "CH32X03x", "CH32V10x" }; |
| 6 | +const char * yes[] = { "CH32X03x", }; |
| 7 | +const char * no[] = { "CH32V10x", "CH32V30x", "CH32V20x", "CH32V003" }; |
8 | 8 |
|
9 | 9 | char * WhitePull( const char ** sti ) |
10 | 10 | { |
@@ -41,31 +41,33 @@ int EvalSpec( const char * spl ) |
41 | 41 | int lastv = 0; |
42 | 42 | int lasto = -1; |
43 | 43 | int ret = 0; |
44 | | - |
| 44 | +cont: |
45 | 45 | char * wp = WhitePull( &spl ); |
46 | 46 | int def = -1; |
47 | 47 | if( strcmp( wp, "defined" ) == 0 ) def = 1; |
48 | 48 | if( strcmp( wp, "!defined" ) == 0 ) def = 2; |
49 | 49 | if( def < 0 ) return 2; |
50 | 50 | char * wpn = WhitePull( &spl ); |
51 | 51 | i = NYI( wpn ); |
52 | | -//printf( "SPIN: %s/%s/%d/%d\n", wp, wpn, i, def ); |
| 52 | +//printf( "SPIN: %s/%s/%d/%d/%d\n", wp, wpn, i, def, lasto ); |
53 | 53 | if( i == 2 ) return 2; |
54 | 54 |
|
55 | 55 | if( def == 2 ) i = !i; |
56 | 56 |
|
57 | 57 | if( lasto == 1 ) |
58 | 58 | ret = lastv || i; |
59 | | - if( lasto == 2 ) |
| 59 | + else if( lasto == 2 ) |
60 | 60 | ret = lastv && i; |
61 | 61 | else |
62 | 62 | ret = i; |
63 | 63 |
|
64 | 64 | char * wpa = WhitePull( &spl ); |
| 65 | +//printf( "WPA: \"%s\"\n", wpa ); |
65 | 66 | lastv = ret; |
66 | 67 | lasto = -1; |
67 | | - if( strcmp( wpa, "||" ) ) { lasto = 1; } |
68 | | - else if( strcmp( wpa, "&&" ) ) { lasto = 2; } |
| 68 | +//printf( "RET: %d\n", ret ); |
| 69 | + if( strcmp( wpa, "||" ) == 0 ) { lasto = 1; goto cont; } |
| 70 | + else if( strcmp( wpa, "&&" ) == 0 ) { lasto = 2; goto cont; } |
69 | 71 | else return ret; |
70 | 72 | } |
71 | 73 |
|
@@ -104,7 +106,7 @@ int NoYesInd( const char * preprocc ) |
104 | 106 | return ret; |
105 | 107 | } |
106 | 108 |
|
107 | | -const char * sslineis( const char * line, const char * match ) |
| 109 | +char * sslineis( const char * line, const char * match ) |
108 | 110 | { |
109 | 111 | while( *line == ' ' || *line == '\t' ) line++; |
110 | 112 | const char * linestart = line; |
|
0 commit comments