forked from KiCad/kicad-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.cpp
More file actions
797 lines (672 loc) · 25.4 KB
/
common.cpp
File metadata and controls
797 lines (672 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <eda_base_frame.h>
#include <kiplatform/app.h>
#include <project.h>
#include <common.h>
#include <confirm.h>
#include <env_vars.h>
#include <advanced_config.h>
#include <reporter.h>
#include <macros.h>
#include <string_utils.h>
#include <text_eval/text_eval_wrapper.h>
#include <mutex>
#include <wx/config.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <wx/stdpaths.h>
#include <wx/url.h>
#include <wx/utils.h>
#include <wx/regex.h>
#ifdef _WIN32
#include <windows.h>
#endif
enum Bracket
{
Bracket_None,
Bracket_Normal = ')',
Bracket_Curly = '}',
#ifdef __WINDOWS__
Bracket_Windows = '%', // yeah, Windows people are a bit strange ;-)
#endif
Bracket_Max
};
wxString ExpandTextVars( const wxString& aSource, const PROJECT* aProject, int aFlags )
{
std::function<bool( wxString* )> projectResolver = [&]( wxString* token ) -> bool
{
return aProject->TextVarResolver( token );
};
return ExpandTextVars( aSource, &projectResolver, aFlags );
}
wxString ExpandTextVars( const wxString& aSource, const std::function<bool( wxString* )>* aResolver, int aFlags,
int aDepth )
{
wxString newbuf;
size_t sourceLen = aSource.length();
newbuf.Alloc( sourceLen ); // best guess (improves performance)
// Get the maximum recursion depth from advanced config
const int maxDepth = ADVANCED_CFG::GetCfg().m_ResolveTextRecursionDepth;
for( size_t i = 0; i < sourceLen; ++i )
{
// Skip over existing escape markers without processing their contents
// This prevents expanding ${} or @{} that are inside escaped expressions
if( i + 14 <= sourceLen && aSource.Mid( i, 14 ) == wxT( "<<<ESC_DOLLAR:" ) )
{
// Copy the entire escape marker including contents until matching closing }
newbuf.append( wxT( "<<<ESC_DOLLAR:" ) );
i += 14;
// Count braces to find the matching closing }
int braceCount = 1;
while( i < sourceLen && braceCount > 0 )
{
if( aSource[i] == '{' )
braceCount++;
else if( aSource[i] == '}' )
braceCount--;
newbuf.append( aSource[i] );
i++;
}
i--; // Back up one since the for loop will increment
continue;
}
else if( i + 10 <= sourceLen && aSource.Mid( i, 10 ) == wxT( "<<<ESC_AT:" ) )
{
// Copy the entire escape marker including contents until matching closing }
newbuf.append( wxT( "<<<ESC_AT:" ) );
i += 10;
// Count braces to find the matching closing }
int braceCount = 1;
while( i < sourceLen && braceCount > 0 )
{
if( aSource[i] == '{' )
braceCount++;
else if( aSource[i] == '}' )
braceCount--;
newbuf.append( aSource[i] );
i++;
}
i--; // Back up one since the for loop will increment
continue;
}
// Handle escaped variable references: \${...} or \@{...}
// Replace with escape markers that won't be expanded by multi-pass loops
// The markers will be converted back to ${...} or @{...} only at the final display stage
if( aSource[i] == '\\' && i + 1 < sourceLen )
{
if( ( aSource[i + 1] == '$' || aSource[i + 1] == '@' ) && i + 2 < sourceLen && aSource[i + 2] == '{' )
{
// Replace \${ with <<<ESC_DOLLAR: and \@{ with <<<ESC_AT:
// Using unique delimiters without braces to avoid confusing the expression evaluator
if( aSource[i + 1] == '$' )
newbuf.append( wxT( "<<<ESC_DOLLAR:" ) );
else
newbuf.append( wxT( "<<<ESC_AT:" ) );
i += 2;
// Copy everything until the matching closing brace, including the brace
int braceDepth = 1;
for( i = i + 1; i < sourceLen && braceDepth > 0; ++i )
{
if( aSource[i] == '{' )
braceDepth++;
else if( aSource[i] == '}' )
braceDepth--;
newbuf.append( aSource[i] );
}
i--; // Adjust because loop will increment
continue;
}
}
if( ( aSource[i] == '$' || aSource[i] == '@' ) && i + 1 < sourceLen && aSource[i + 1] == '{' )
{
bool isMathExpr = ( aSource[i] == '@' );
wxString token;
int braceDepth = 1; // Track brace depth for nested expressions like @{${VAR}}
for( i = i + 2; i < sourceLen; ++i )
{
// Skip over escape markers - don't count their braces
// This prevents <<<ESC_DOLLAR:X} from interfering with outer brace counting
if( i + 14 <= sourceLen && aSource.Mid( i, 14 ) == wxT( "<<<ESC_DOLLAR:" ) )
{
token.append( wxT( "<<<ESC_DOLLAR:" ) );
i += 14;
// Copy contents until matching closing brace (tracking nested braces)
int markerBraceCount = 1;
while( i < sourceLen && markerBraceCount > 0 )
{
if( aSource[i] == '{' )
markerBraceCount++;
else if( aSource[i] == '}' )
markerBraceCount--;
token.append( aSource[i] );
i++;
}
i--; // Adjust for outer loop increment
continue;
}
else if( i + 10 <= sourceLen && aSource.Mid( i, 10 ) == wxT( "<<<ESC_AT:" ) )
{
token.append( wxT( "<<<ESC_AT:" ) );
i += 10;
// Copy contents until matching closing brace (tracking nested braces)
int markerBraceCount = 1;
while( i < sourceLen && markerBraceCount > 0 )
{
if( aSource[i] == '{' )
markerBraceCount++;
else if( aSource[i] == '}' )
markerBraceCount--;
token.append( aSource[i] );
i++;
}
i--; // Adjust for outer loop increment
continue;
}
if( aSource[i] == '{' )
{
braceDepth++;
token.append( aSource[i] );
}
else if( aSource[i] == '}' )
{
braceDepth--;
if( braceDepth == 0 )
break; // Found the matching closing brace
else
token.append( aSource[i] );
}
else
{
token.append( aSource[i] );
}
}
if( token.IsEmpty() )
continue;
// For math expressions @{...}, recursively expand any nested ${...} variables
// but DON'T evaluate the math - leave that for EvaluateText() called by the user
if( isMathExpr )
{
if( ( token.Contains( wxT( "${" ) ) || token.Contains( wxT( "@{" ) ) ) && aDepth < maxDepth )
{
token = ExpandTextVars( token, aResolver, aFlags, aDepth + 1 );
}
// Return the expression with variables expanded but NOT evaluated
// The caller will use EvaluateText() to handle the math evaluation
newbuf.append( wxT( "@{" ) + token + wxT( "}" ) );
}
else // Variable reference ${...}
{
// Recursively expand nested variables BEFORE passing to resolver
// This ensures innermost variables are expanded first (standard evaluation order)
if( ( token.Contains( wxT( "${" ) ) || token.Contains( wxT( "@{" ) ) ) && aDepth < maxDepth )
{
token = ExpandTextVars( token, aResolver, aFlags, aDepth + 1 );
// Also evaluate math expressions after expanding variables
if( token.Contains( wxT( "@{" ) ) )
{
static EXPRESSION_EVALUATOR evaluator;
token = evaluator.Evaluate( token );
}
}
if( ( aFlags & FOR_ERC_DRC ) == 0
&& ( token.StartsWith( wxS( "ERC_WARNING" ) ) || token.StartsWith( wxS( "ERC_ERROR" ) )
|| token.StartsWith( wxS( "DRC_WARNING" ) ) || token.StartsWith( wxS( "DRC_ERROR" ) ) ) )
{
// Only show user-defined warnings/errors during ERC/DRC
}
else if( aResolver && ( *aResolver )( &token ) )
{
newbuf.append( token );
}
else
{
// Token not resolved: leave the reference unchanged
newbuf.append( "${" + token + "}" );
}
}
}
else
{
newbuf.append( aSource[i] );
}
}
return newbuf;
}
wxString ResolveTextVars( const wxString& aSource, const std::function<bool( wxString* )>* aResolver, int& aDepth )
{
// Multi-pass resolution to handle nested variables like ${J601:UNIT(${ROW})}
// and math expressions like @{${ROW}-1}
wxString text = aSource;
const int maxDepth = ADVANCED_CFG::GetCfg().m_ResolveTextRecursionDepth;
static EXPRESSION_EVALUATOR evaluator;
while( ( text.Contains( wxT( "${" ) ) || text.Contains( wxT( "@{" ) ) ) && ++aDepth <= maxDepth )
{
// Always expand when ${} or @{} present to handle escape sequences (\${} and \@{})
// ExpandTextVars converts escapes to markers and expands ${} variables
// Don't expand if the only remaining $ or @ are in escape markers like <<<ESC_DOLLAR: or <<<ESC_AT:
if( text.Contains( wxT( "${" ) ) || text.Contains( wxT( "@{" ) ) )
text = ExpandTextVars( text, aResolver );
// Only evaluate if there are @{} expressions present (not escape markers)
// Don't evaluate if the only remaining @ are in escape markers like <<<ESC_AT:
if( text.Contains( wxT( "@{" ) ) )
text = evaluator.Evaluate( text ); // Evaluate math expressions
}
return text;
}
wxString GetGeneratedFieldDisplayName( const wxString& aSource )
{
std::function<bool( wxString* )> tokenExtractor = [&]( wxString* token ) -> bool
{
*token = *token; // token value is the token name
return true;
};
return ExpandTextVars( aSource, &tokenExtractor );
}
bool IsGeneratedField( const wxString& aSource )
{
static wxRegEx expr( wxS( "^\\$\\{\\w*\\}$" ) );
return expr.Matches( aSource );
}
wxString DescribeRef( const wxString& aRef )
{
if( aRef.IsEmpty() )
return wxT( "<i>" ) + _( "unannotated footprint" ) + wxT( " </i>" );
else
return EscapeHTML( aRef );
}
//
// Stolen from wxExpandEnvVars and then heavily optimized
//
wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::set<wxString>* aSet = nullptr )
{
// If the same string is inserted twice, we have a loop
if( aSet )
{
if( auto [_, result] = aSet->insert( str ); !result )
return str;
}
size_t strlen = str.length();
wxString strResult;
strResult.Alloc( strlen ); // best guess (improves performance)
auto getVersionedEnvVar = []( const wxString& aMatch, wxString& aResult ) -> bool
{
for( const wxString& var : ENV_VAR::GetPredefinedEnvVars() )
{
if( var.Matches( aMatch ) )
{
const auto value = ENV_VAR::GetEnvVar<wxString>( var );
if( !value )
continue;
aResult += *value;
return true;
}
}
return false;
};
for( size_t n = 0; n < strlen; n++ )
{
wxUniChar str_n = str[n];
switch( str_n.GetValue() )
{
#ifdef __WINDOWS__
case wxT( '%' ):
#endif // __WINDOWS__
case wxT( '$' ):
{
Bracket bracket;
#ifdef __WINDOWS__
if( str_n == wxT( '%' ) )
{
bracket = Bracket_Windows;
}
else
#endif // __WINDOWS__
if( n == strlen - 1 )
{
bracket = Bracket_None;
}
else
{
switch( str[n + 1].GetValue() )
{
case wxT( '(' ):
bracket = Bracket_Normal;
str_n = str[++n]; // skip the bracket
break;
case wxT( '{' ):
bracket = Bracket_Curly;
str_n = str[++n]; // skip the bracket
break;
default: bracket = Bracket_None;
}
}
size_t m = n + 1;
if( m >= strlen )
break;
wxUniChar str_m = str[m];
while( wxIsalnum( str_m ) || str_m == wxT( '_' ) || str_m == wxT( ':' ) )
{
if( ++m == strlen )
{
str_m = 0;
break;
}
str_m = str[m];
}
wxString strVarName( str.c_str() + n + 1, m - n - 1 );
// NB: use wxGetEnv instead of wxGetenv as otherwise variables
// set through wxSetEnv may not be read correctly!
bool expanded = false;
wxString tmp = strVarName;
if( aProject && aProject->TextVarResolver( &tmp ) )
{
strResult += tmp;
expanded = true;
}
else if( wxGetEnv( strVarName, &tmp ) )
{
strResult += tmp;
expanded = true;
}
// Replace unmatched older variables with current locations
// If the user has the older location defined, that will be matched
// first above. But if they do not, this will ensure that their board still
// displays correctly
else if( strVarName.Contains( "KISYS3DMOD" ) || strVarName.Matches( "KICAD*_3DMODEL_DIR" ) )
{
if( getVersionedEnvVar( "KICAD*_3DMODEL_DIR", strResult ) )
expanded = true;
}
else if( strVarName.Matches( "KICAD*_SYMBOL_DIR" ) )
{
if( getVersionedEnvVar( "KICAD*_SYMBOL_DIR", strResult ) )
expanded = true;
}
else if( strVarName.Matches( "KICAD*_FOOTPRINT_DIR" ) )
{
if( getVersionedEnvVar( "KICAD*_FOOTPRINT_DIR", strResult ) )
expanded = true;
}
else if( strVarName.Matches( "KICAD*_3RD_PARTY" ) )
{
if( getVersionedEnvVar( "KICAD*_3RD_PARTY", strResult ) )
expanded = true;
}
else
{
// variable doesn't exist => don't change anything
#ifdef __WINDOWS__
if( bracket != Bracket_Windows )
#endif
if( bracket != Bracket_None )
strResult << str[n - 1];
strResult << str_n << strVarName;
}
// check the closing bracket
if( bracket != Bracket_None )
{
if( m == strlen || str_m != (wxChar) bracket )
{
// under MSW it's common to have '%' characters in the registry
// and it's annoying to have warnings about them each time, so
// ignore them silently if they are not used for env vars
//
// under Unix, OTOH, this warning could be useful for the user to
// understand why isn't the variable expanded as intended
#ifndef __WINDOWS__
wxLogWarning( _( "Environment variables expansion failed: missing '%c' "
"at position %u in '%s'." ),
(char) bracket, (unsigned int) ( m + 1 ), str.c_str() );
#endif // __WINDOWS__
}
else
{
// skip closing bracket unless the variables wasn't expanded
if( !expanded )
strResult << (wxChar) bracket;
m++;
}
}
n = m - 1; // skip variable name
str_n = str[n];
}
break;
case wxT( '\\' ):
// backslash can be used to suppress special meaning of % and $
if( n < strlen - 1 && ( str[n + 1] == wxT( '%' ) || str[n + 1] == wxT( '$' ) ) )
{
str_n = str[++n];
strResult += str_n;
break;
}
KI_FALLTHROUGH;
default: strResult += str_n;
}
}
std::set<wxString> loop_check;
auto first_pos = strResult.find_first_of( wxS( "{(%" ) );
auto last_pos = strResult.find_last_of( wxS( "})%" ) );
if( first_pos != strResult.npos && last_pos != strResult.npos && first_pos != last_pos )
strResult = KIwxExpandEnvVars( strResult, aProject, aSet ? aSet : &loop_check );
return strResult;
}
const wxString ExpandEnvVarSubstitutions( const wxString& aString, const PROJECT* aProject )
{
// wxGetenv( wchar_t* ) is not re-entrant on linux.
// Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(),
static std::mutex getenv_mutex;
std::lock_guard<std::mutex> lock( getenv_mutex );
// We reserve the right to do this another way, by providing our own member function.
return KIwxExpandEnvVars( aString, aProject );
}
const wxString ResolveUriByEnvVars( const wxString& aUri, const PROJECT* aProject )
{
wxString uri = ExpandTextVars( aUri, aProject );
return ExpandEnvVarSubstitutions( uri, aProject );
}
bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName, const wxString& aBaseFilename, REPORTER* aReporter )
{
wxString msg;
wxString baseFilePath = wxFileName( aBaseFilename ).GetPath();
// make aTargetFullFileName path, which is relative to aBaseFilename path (if it is not
// already an absolute path) absolute:
if( !aTargetFullFileName->MakeAbsolute( baseFilePath ) )
{
if( aReporter )
{
msg.Printf( _( "Cannot make path '%s' absolute with respect to '%s'." ), aTargetFullFileName->GetPath(),
baseFilePath );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
return false;
}
// Ensure the path of aTargetFullFileName exists, and create it if needed:
wxString outputPath( aTargetFullFileName->GetPath() );
if( !wxFileName::DirExists( outputPath ) )
{
// Make every directory provided when the provided path doesn't exist
if( wxFileName::Mkdir( outputPath, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
{
if( aReporter )
{
msg.Printf( _( "Output directory '%s' created." ), outputPath );
aReporter->Report( msg, RPT_SEVERITY_INFO );
return true;
}
}
else
{
if( aReporter )
{
msg.Printf( _( "Cannot create output directory '%s'." ), outputPath );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
return false;
}
}
return true;
}
wxString EnsureFileExtension( const wxString& aFilename, const wxString& aExtension )
{
wxString newFilename( aFilename );
// It's annoying to throw up nag dialogs when the extension isn't right. Just fix it,
// but be careful not to destroy existing after-dot-text that isn't actually a bad
// extension, such as "Schematic_1.1".
if( newFilename.Lower().AfterLast( '.' ) != aExtension )
{
if( !newFilename.EndsWith( '.' ) )
newFilename.Append( '.' );
newFilename.Append( aExtension );
}
return newFilename;
}
wxString JoinExtensions( const std::vector<std::string>& aExts )
{
wxString joined;
for( const std::string& ext : aExts )
{
if( !joined.empty() )
joined << wxS( ", " );
joined << wxS( "*." ) << ext;
}
return joined;
}
/**
* Performance enhancements to file and directory operations.
*
* Note: while it's annoying to have to make copies of wxWidgets stuff and then
* add platform-specific performance optimizations, the following routines offer
* SIGNIFICANT performance benefits.
*/
/**
* A copy of wxMatchWild(), which wxWidgets attributes to Douglas A. Lewis
* <dalewis@cs.Buffalo.EDU> and ircII's reg.c.
*
* This version is modified to skip any encoding conversions (for performance).
*/
bool matchWild( const char* pat, const char* text, bool dot_special )
{
if( !*text )
{
/* Match if both are empty. */
return !*pat;
}
const char *m = pat, *n = text, *ma = nullptr, *na = nullptr;
int just = 0, acount = 0, count = 0;
if( dot_special && ( *n == '.' ) )
{
/* Never match so that hidden Unix files
* are never found. */
return false;
}
for( ;; )
{
if( *m == '*' )
{
ma = ++m;
na = n;
just = 1;
acount = count;
}
else if( *m == '?' )
{
m++;
if( !*n++ )
return false;
}
else
{
if( *m == '\\' )
{
m++;
/* Quoting "nothing" is a bad thing */
if( !*m )
return false;
}
if( !*m )
{
/*
* If we are out of both strings or we just
* saw a wildcard, then we can say we have a
* match
*/
if( !*n )
return true;
if( just )
return true;
just = 0;
goto not_matched;
}
/*
* We could check for *n == NULL at this point, but
* since it's more common to have a character there,
* check to see if they match first (m and n) and
* then if they don't match, THEN we can check for
* the NULL of n
*/
just = 0;
if( *m == *n )
{
m++;
count++;
n++;
}
else
{
not_matched:
/*
* If there are no more characters in the
* string, but we still need to find another
* character (*m != NULL), then it will be
* impossible to match it
*/
if( !*n )
return false;
if( ma )
{
m = ma;
n = ++na;
count = acount;
}
else
return false;
}
}
}
}
bool WarnUserIfOperatingSystemUnsupported()
{
if( !KIPLATFORM::APP::IsOperatingSystemUnsupported() )
return false;
KICAD_MESSAGE_DIALOG dialog( nullptr,
_( "This operating system is not supported "
"by KiCad and its dependencies." ),
_( "Unsupported Operating System" ), wxOK | wxICON_EXCLAMATION );
dialog.SetExtendedMessage( _( "Any issues with KiCad on this system cannot "
"be reported to the official bugtracker." ) );
dialog.ShowModal();
return true;
}