Subversion Repositories Kolibri OS

Rev

Rev 9907 | Rev 9913 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9907 Rev 9909
Line 876... Line 876...
876
		END
876
		END
877
	END append;
877
	END append;
Line 878... Line 878...
878
 
878
 
879
 
-
 
880
BEGIN
-
 
881
	IF ~_copy THEN
-
 
882
		cnt := -lenEOL;
-
 
883
		line := text.first(tLine);
-
 
884
		WHILE line # NIL DO
-
 
885
			INC(cnt, lenEOL);
-
 
886
			line.pos := cnt;
-
 
887
			INC(cnt, line.length);
-
 
888
			NextLine(line)
-
 
889
		END
-
 
890
	END;
879
 
891
 
880
BEGIN
Line 892... Line 881...
892
	first := getLine2(text, textStart.Y);
881
	first := getLine2(text, textStart.Y);
893
	line := first;
882
	line := first;
Line 924... Line 913...
924
 
913
 
925
	RETURN buffer
914
	RETURN buffer
Line 926... Line 915...
926
END plain;
915
END plain;
927
 
916
 
928
 
917
 
-
 
918
PROCEDURE ClearSearch (text: tText);
-
 
919
VAR
-
 
920
	pos: List.tItem;
-
 
921
	line: tLine;
-
 
922
	cnt: INTEGER;
-
 
923
BEGIN
-
 
924
	cnt := -lenEOL;
-
 
925
	line := text.first(tLine);
-
 
926
	WHILE line # NIL DO
-
 
927
		INC(cnt, lenEOL);
-
 
928
		line.pos := cnt;
-
 
929
		INC(cnt, line.length);
-
 
930
		NextLine(line)
-
 
931
	END;
-
 
932
 
-
 
933
	WHILE text.foundList.count # 0 DO
-
 
934
		pos := List.pop(text.foundList);
-
 
935
		DISPOSE(pos)
-
 
936
	END
-
 
937
END ClearSearch;
-
 
938
 
929
PROCEDURE _search (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN; textStart, textEnd: tPoint): BOOLEAN;
939
 
930
VAR
940
PROCEDURE _search (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN; textStart, textEnd: tPoint): BOOLEAN;
931
	pos: List.tItem;
941
VAR
Line 932... Line 942...
932
	res: BOOLEAN;
942
	res: BOOLEAN;
933
	plainText, idxData: CB.tBuffer;
943
	plainText, idxData: CB.tBuffer;
934
	first: tLine;
944
	first: tLine;
935
 
945
 
936
BEGIN
-
 
937
	res := TRUE;
-
 
938
	plainText := NIL;
-
 
939
	idxData := NIL;
-
 
940
	WHILE text.foundList.count # 0 DO
946
BEGIN
941
		pos := List.pop(text.foundList);
947
	res := TRUE;
942
		DISPOSE(pos)
948
	plainText := NIL;
943
	END;
949
	idxData := NIL;
944
	text.whole := whole;
950
	text.whole := whole;
Line 967... Line 973...
967
 
973
 
968
 
974
 
969
PROCEDURE search* (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN): BOOLEAN;
975
PROCEDURE search* (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN): BOOLEAN;
970
VAR
-
 
971
	textStart, textEnd: tPoint;
-
 
972
(*
-
 
973
	PROCEDURE _getSelect (text: tText; VAR selBeg, selEnd: tPoint);
-
 
974
	BEGIN
-
 
975
	    selBeg := text.cursor^;
-
 
976
	    selEnd := text.select^;
-
 
977
	    IF (selBeg.Y > selEnd.Y) OR (selBeg.Y = selEnd.Y) & (selBeg.X > selEnd.X) THEN
-
 
978
	        selBeg := text.select^;
-
 
979
	        selEnd := text.cursor^
-
 
980
	    END
-
 
981
	END _getSelect;*)
976
VAR
982
 
977
	textStart, textEnd: tPoint;
983
BEGIN
978
BEGIN
984
	textStart.Y := 0; textStart.X := 0;
979
	textStart.Y := 0; textStart.X := 0;
985
	textEnd.Y := text.count - 1; textEnd.X := text.last(tLine).length;
980
	textEnd.Y := text.count - 1; textEnd.X := text.last(tLine).length;
986
	//_getSelect(text, textStart, textEnd)
981
	ClearSearch(text)
Line -... Line 982...
-
 
982
	RETURN _search(text, s, cs, whole, textStart, textEnd)
-
 
983
END search;
-
 
984
 
-
 
985
 
-
 
986
PROCEDURE fasm_anon (text: tText);
-
 
987
VAR
-
 
988
	textStart, textEnd: tPoint;
-
 
989
	res, frw, back, label, anon_label: BOOLEAN;
-
 
990
	Y1, Y2, i, k, j: INTEGER;
-
 
991
	line, Label: tLine;
-
 
992
	str: ARRAY 8 OF WCHAR;
-
 
993
 
-
 
994
 
-
 
995
	PROCEDURE anon (line: tLine): BOOLEAN;
-
 
996
	VAR
-
 
997
		i: INTEGER;
-
 
998
	BEGIN
-
 
999
		i := leadingSpaces(line)
-
 
1000
		RETURN (Lines.getChar(line, i) = "@") &
-
 
1001
				(Lines.getChar(line, i + 1) = "@") &
-
 
1002
				(Lines.getChar(line, i + 2) = ":")
-
 
1003
	END anon;
-
 
1004
 
-
 
1005
 
-
 
1006
BEGIN
-
 
1007
	frw := FALSE;
-
 
1008
	back := FALSE;
-
 
1009
	label := FALSE;
-
 
1010
	line := text.curLine;
-
 
1011
 
-
 
1012
	i := text.cursor.X;
-
 
1013
	j := 0;
-
 
1014
	FOR k := i - 3 TO i + 2 DO
-
 
1015
		str[j] := U.lcase(Lines.getChar(line, k));
-
 
1016
		INC(j)
-
 
1017
	END;
-
 
1018
	j := 3;
-
 
1019
 
-
 
1020
	anon_label := anon(line);
-
 
1021
 
-
 
1022
	IF str[j] = "@" THEN
-
 
1023
		IF str[j + 1] = "f" THEN
-
 
1024
			frw := TRUE
-
 
1025
		ELSIF (str[j + 1] = "b") OR (str[j + 1] = "r") THEN
-
 
1026
			back := TRUE
-
 
1027
		ELSIF anon_label & (((str[j + 1] = "@") & (str[j + 2] = ":")) OR
-
 
1028
				((str[j - 1] = "@") & (str[j + 1] = ":"))) THEN
-
 
1029
			label := TRUE
-
 
1030
		END
-
 
1031
	ELSIF str[j - 1] = "@" THEN
-
 
1032
		IF str[j] = "f" THEN
-
 
1033
			frw := TRUE
-
 
1034
		ELSIF (str[j] = "b") OR (str[j] = "r") THEN
-
 
1035
			back := TRUE
-
 
1036
		ELSIF anon_label & (str[j] = ":") & (str[j - 2] = "@") THEN
-
 
1037
			label := TRUE
-
 
1038
		END
-
 
1039
	ELSIF anon_label & (str[j] = ":") & (str[j - 1] = "@") & (str[j - 2] = "@") THEN
-
 
1040
		label := TRUE
-
 
1041
	ELSIF (str[j - 1] = "f") & (str[j - 2] = "@") THEN
-
 
1042
		frw := TRUE
-
 
1043
	ELSIF ((str[j - 1] = "b") OR (str[j - 1] = "r")) & (str[j - 2] = "@") THEN
-
 
1044
		back := TRUE
-
 
1045
	ELSIF anon_label & (str[j - 1] = ":") & (str[j - 2] = "@") & (str[j - 3] = "@") THEN
-
 
1046
		label := TRUE
-
 
1047
	END;
-
 
1048
 
-
 
1049
	IF back OR frw OR label THEN
-
 
1050
		Y1 := text.cursor.Y;
-
 
1051
		Y2 := Y1;
-
 
1052
 
-
 
1053
		IF label THEN
-
 
1054
			Label := line;
-
 
1055
			DEC(Y1)
-
 
1056
		ELSE
-
 
1057
			Label := NIL
-
 
1058
		END;
-
 
1059
 
-
 
1060
		line := getLine2(text, Y1);
-
 
1061
		WHILE (Y1 > 0) & ~anon(line) DO
-
 
1062
			PrevLine(line);
-
 
1063
			DEC(Y1)
-
 
1064
		END;
-
 
1065
 
-
 
1066
		line := getLine2(text, Y2);
-
 
1067
		IF anon(line) THEN
-
 
1068
			NextLine(line);
-
 
1069
			INC(Y2)
-
 
1070
		END;
-
 
1071
 
-
 
1072
		WHILE (Y2 < text.count) & ~anon(line) DO
-
 
1073
			NextLine(line);
-
 
1074
			INC(Y2)
-
 
1075
		END;
-
 
1076
 
-
 
1077
		IF Y1 < 0 THEN
-
 
1078
			Y1 := 0
-
 
1079
		ELSIF back THEN
-
 
1080
			Label := getLine2(text, Y1)
-
 
1081
		END;
-
 
1082
		textStart.Y := Y1; textStart.X := 0;
-
 
1083
		IF Y2 = text.count THEN
-
 
1084
			DEC(Y2);
-
 
1085
			textEnd.X := text.last(tLine).length
-
 
1086
		ELSIF frw THEN
-
 
1087
			Label := getLine2(text, Y2);
-
 
1088
			textEnd.X := 0
-
 
1089
		END;
-
 
1090
		textEnd.Y := Y2;
-
 
1091
		ClearSearch(text);
-
 
1092
		text.smallMove := FALSE;
-
 
1093
		IF (Label # NIL) & ~anon(Label) THEN
-
 
1094
			Label := NIL
-
 
1095
		END
-
 
1096
	END;
-
 
1097
 
-
 
1098
	IF frw THEN
-
 
1099
		res := _search(text, "@f", FALSE, FALSE, textStart, textEnd);
-
 
1100
		IF Label # NIL THEN
-
 
1101
			Search.add(text.foundList, Label.pos + leadingSpaces(Label))
-
 
1102
		END
-
 
1103
	ELSIF back THEN
-
 
1104
		IF Label # NIL THEN
-
 
1105
			Search.add(text.foundList, Label.pos + leadingSpaces(Label))
-
 
1106
		END;
-
 
1107
		res := _search(text, "@b", FALSE, FALSE, textStart, textEnd);
-
 
1108
		res := _search(text, "@r", FALSE, FALSE, textStart, textEnd)
-
 
1109
	ELSIF label THEN
-
 
1110
		res := _search(text, "@f", FALSE, FALSE, textStart, text.cursor^);
-
 
1111
		IF Label # NIL THEN
-
 
1112
			Search.add(text.foundList, Label.pos + leadingSpaces(Label))
-
 
1113
		END;
-
 
1114
		res := _search(text, "@b", FALSE, FALSE, text.cursor^, textEnd);
-
 
1115
		res := _search(text, "@r", FALSE, FALSE, text.cursor^, textEnd)
987
	RETURN _search(text, s, cs, whole, textStart, textEnd)
1116
	END
988
END search;
1117
END fasm_anon;
989
 
1118
 
990
 
1119
 
991
PROCEDURE modify (text: tText);
1120
PROCEDURE modify (text: tText);
Line 2032... Line 2161...
2032
	    IF text.searchText # str THEN
2161
	    IF text.searchText # str THEN
2033
	    	text.smallMove := FALSE
2162
	    	text.smallMove := FALSE
2034
	    END;
2163
	    END;
2035
	    IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END;
2164
	    IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END;
2036
	    text.wordSel := FALSE
2165
	    text.wordSel := FALSE
-
 
2166
    END;
-
 
2167
    IF (text.lang = Lang.langFasm) & ~selected(text) THEN
-
 
2168
    	fasm_anon(text)
2037
    END
2169
    END
2038
END wordSel;
2170
END wordSel;
Line 2039... Line 2171...
2039
 
2171