|
@@ -798,6 +798,34 @@ cmChar_t* cmTextLine( cmChar_t* s, unsigned line )
|
798
|
798
|
const cmChar_t* cmTextLineC( const cmChar_t* s, unsigned line )
|
799
|
799
|
{ return cmTextLine((cmChar_t*)s,line); }
|
800
|
800
|
|
|
801
|
+unsigned cmTextLineCount( const cmChar_t* s )
|
|
802
|
+{
|
|
803
|
+ unsigned n = *s ? 1 : 0;
|
|
804
|
+
|
|
805
|
+ while( *s )
|
|
806
|
+ {
|
|
807
|
+ s = cmTextEndOfLineC(s);
|
|
808
|
+
|
|
809
|
+ switch( *s )
|
|
810
|
+ {
|
|
811
|
+ case 0:
|
|
812
|
+ break;
|
|
813
|
+
|
|
814
|
+ case '\n':
|
|
815
|
+ s += 1;
|
|
816
|
+ n += 1;
|
|
817
|
+ break;
|
|
818
|
+
|
|
819
|
+ default:
|
|
820
|
+ { assert(0); }
|
|
821
|
+ }
|
|
822
|
+
|
|
823
|
+ }
|
|
824
|
+
|
|
825
|
+ return n;
|
|
826
|
+
|
|
827
|
+}
|
|
828
|
+
|
801
|
829
|
|
802
|
830
|
cmChar_t* cmTextRemoveConsecutiveSpaces( cmChar_t* s )
|
803
|
831
|
{
|