changeset 3065:7f1d390cbd83

Add QScintilla blockcomments patch * src/qscintilla-1-matlab-blockcomments.patch: New file * src/qscintilla.mk: change PKG_SUBDIR to base of tarball so patch works, and change PKG_BUILD to (1)/Qt4Qt5.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 18 Jun 2013 18:34:53 -0400
parents be70678cc47b
children 23e3e2955cf5
files src/qscintilla-1-matlab-blockcomments.patch src/qscintilla.mk
diffstat 2 files changed, 142 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/qscintilla-1-matlab-blockcomments.patch	Tue Jun 18 18:34:53 2013 -0400
@@ -0,0 +1,138 @@
+diff -p -u -r QScintilla-gpl-2.7.2-snapshot-0714ef531ead.orig/lexers/LexMatlab.cpp QScintilla-gpl-2.7.2-snapshot-0714ef531ead/lexers/LexMatlab.cpp
+--- QScintilla-gpl-2.7.2-snapshot-0714ef531ead.orig/lexers/LexMatlab.cpp	2013-05-14 20:55:15.000000000 -0400
++++ QScintilla-gpl-2.7.2-snapshot-0714ef531ead/lexers/LexMatlab.cpp	2013-05-14 20:56:15.000000000 -0400
+@@ -6,6 +6,12 @@
+  ** Changes by Christoph Dalitz 2003/12/04:
+  **   - added support for Octave
+  **   - Strings can now be included both in single or double quotes
++ **
++ ** Changes by John Donoghue 2012/04/02
++ **   - added block comment (and nested block comments)
++ **   - added ... displayed as a comment
++ **   - removed unused IsAWord functions
++ **   - added some comments
+  **/
+ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
+ // The License.txt file describes the conditions under which this software may be distributed.
+@@ -48,14 +54,6 @@ static bool IsOctaveComment(Accessor &st
+ 	return len > 0 && IsOctaveCommentChar(styler[pos]) ;
+ }
+ 
+-static inline bool IsAWordChar(const int ch) {
+-	return (ch < 0x80) && (isalnum(ch) || ch == '_');
+-}
+-
+-static inline bool IsAWordStart(const int ch) {
+-	return (ch < 0x80) && (isalnum(ch) || ch == '_');
+-}
+-
+ static void ColouriseMatlabOctaveDoc(
+             unsigned int startPos, int length, int initStyle,
+             WordList *keywordlists[], Accessor &styler,
+@@ -65,12 +63,41 @@ static void ColouriseMatlabOctaveDoc(
+ 
+ 	styler.StartAt(startPos);
+ 
++	// boolean for when the ' is allowed to be transpose vs the start/end 
++	// of a string
+ 	bool transpose = false;
+ 
++	// approximate position of first non space character in a line
++	int nonSpaceColumn = -1;
++	// approximate column position of the current character in a line
++	int column = 0;
++
++        // use the line state of each line to store the block comment depth
++	int curLine = styler.GetLine(startPos);
++        int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0;
++
++
+ 	StyleContext sc(startPos, length, initStyle, styler);
+ 
+-	for (; sc.More(); sc.Forward()) {
++	for (; sc.More(); sc.Forward(), column++) {
++
++               	if(sc.atLineStart) {
++			// set the line state to the current commentDepth 
++			curLine = styler.GetLine(sc.currentPos);
++                        styler.SetLineState(curLine, commentDepth);
++
++			// reset the column to 0, nonSpace to -1 (not set)
++			column = 0;
++			nonSpaceColumn = -1; 
++		}
++
++		// save the column position of first non space character in a line
++		if((nonSpaceColumn == -1) && (! IsASpace(sc.ch)))
++		{
++			nonSpaceColumn = column;
++		}
+ 
++		// check for end of states
+ 		if (sc.state == SCE_MATLAB_OPERATOR) {
+ 			if (sc.chPrev == '.') {
+ 				if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') {
+@@ -79,6 +106,10 @@ static void ColouriseMatlabOctaveDoc(
+ 				} else if (sc.ch == '\'') {
+ 					sc.ForwardSetState(SCE_MATLAB_DEFAULT);
+ 					transpose = true;
++                                } else if(sc.ch == '.' && sc.chNext == '.') {
++                                        // we werent an operator, but a '...' 
++                                        sc.ChangeState(SCE_MATLAB_COMMENT);
++                                        transpose = false;
+ 				} else {
+ 					sc.SetState(SCE_MATLAB_DEFAULT);
+ 				}
+@@ -121,15 +152,51 @@ static void ColouriseMatlabOctaveDoc(
+ 			} else if (sc.ch == '\"') {
+ 				sc.ForwardSetState(SCE_MATLAB_DEFAULT);
+ 			}
+-		} else if (sc.state == SCE_MATLAB_COMMENT || sc.state == SCE_MATLAB_COMMAND) {
++		} else if (sc.state == SCE_MATLAB_COMMAND) {
+ 			if (sc.atLineEnd) {
+ 				sc.SetState(SCE_MATLAB_DEFAULT);
+ 				transpose = false;
+ 			}
++		} else if (sc.state == SCE_MATLAB_COMMENT) {
++			// end or start of a nested a block comment?
++			if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) {
++                           	if(commentDepth > 0) commentDepth --;
++ 
++				curLine = styler.GetLine(sc.currentPos);
++				styler.SetLineState(curLine, commentDepth);
++				sc.Forward();
++
++				if (commentDepth == 0) {
++					sc.ForwardSetState(SCE_D_DEFAULT);
++					transpose = false;
++				}
++                        }
++                        else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column)
++                        {
++ 				commentDepth ++;
++
++				curLine = styler.GetLine(sc.currentPos);
++				styler.SetLineState(curLine, commentDepth);
++				sc.Forward();
++				transpose = false;
++
++                        } else if(commentDepth == 0) {
++				// single line comment
++				if (sc.atLineEnd || sc.ch == '\r' || sc.ch == '\n') {
++					sc.SetState(SCE_MATLAB_DEFAULT);
++					transpose = false;
++				}
++			}
+ 		}
+ 
++		// check start of a new state
+ 		if (sc.state == SCE_MATLAB_DEFAULT) {
+ 			if (IsCommentChar(sc.ch)) {
++				// ncrement depth if we are a block comment
++				if(sc.chNext == '{' && nonSpaceColumn == column)
++					commentDepth ++;
++				curLine = styler.GetLine(sc.currentPos);
++				styler.SetLineState(curLine, commentDepth);
+ 				sc.SetState(SCE_MATLAB_COMMENT);
+ 			} else if (sc.ch == '!' && sc.chNext != '=' ) {
+ 				sc.SetState(SCE_MATLAB_COMMAND);
--- a/src/qscintilla.mk	Mon Jun 17 22:13:30 2013 -0400
+++ b/src/qscintilla.mk	Tue Jun 18 18:34:53 2013 -0400
@@ -4,7 +4,7 @@
 PKG             := qscintilla
 $(PKG)_IGNORE   :=
 $(PKG)_CHECKSUM := 2a11fb6be2c3005bc6502f929a0a339d4303af9b
-$(PKG)_SUBDIR   := QScintilla-gpl-$($(PKG)_VERSION)/Qt4Qt5
+$(PKG)_SUBDIR   := QScintilla-gpl-$($(PKG)_VERSION)
 $(PKG)_FILE     := QScintilla-gpl-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := http://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-$($(PKG)_VERSION)/$($(PKG)_FILE)
 $(PKG)_DEPS     := qt
@@ -21,10 +21,10 @@
 endif
 
 define $(PKG)_BUILD
-    cd '$(1)' && '$(HOST_BINDIR)/qmake' -makefile $($(PKG)_QMAKE_SPEC_OPTION)
+    cd '$(1)/Qt4Qt5' && '$(HOST_BINDIR)/qmake' -makefile $($(PKG)_QMAKE_SPEC_OPTION)
 
-    $(MAKE) -C '$(1)' -j '$(JOBS)'
-    $(MAKE) -C '$(1)' -j 1 install
+    $(MAKE) -C '$(1)/Qt4Qt5' -j '$(JOBS)'
+    $(MAKE) -C '$(1)/Qt4Qt5' -j 1 install
     if [ $(MXE_SYSTEM) = mingw ]; then \
       $(INSTALL) -m755 '$(HOST_LIBDIR)/qscintilla2.dll' '$(HOST_BINDIR)/qscintilla2.dll'; \
     fi