OSDN Git Service

This commit was manufactured by cvs2svn to create branch 'Bb62'.
[gikonavigoeson/gikonavi.git] / AbonUnit.pas
index 484b75d..7ed4958 100644 (file)
@@ -115,6 +115,7 @@ type
        //--
        function TreatSyria(AString: string): string;
     //--
+    function AddToken(AString: string; Invisible: Boolean): Boolean;
   end;
 var
        Abon1 :TAbon;
@@ -383,14 +384,20 @@ begin
                                buftoken := Copy(argline,1,pos-1);
                                Delete(argline,1,pos);
                                if Length(buftoken) > 0 then begin
-                                       bufstl.Append(buftoken);
+                    // >> \82Å\8en\82Ü\82é\83g\81[\83N\83\93\82Í\83R\83\81\83\93\83g\88µ\82¢\82Å\96³\8e\8b\82·\82é
+                    if AnsiPos('>>', buftoken) <> 1 then begin
+                                       bufstl.Append(buftoken);
+                    end;
                                end else if ( bufstl.Count = 0 ) then begin
                                        bufstl.Append('');
                                end;
                                pos := AnsiPos(#9,argline);
                        end;
                        if Length(argline) > 0 then begin
-                               bufstl.Append(argline);
+                // >> \82Å\8en\82Ü\82é\83g\81[\83N\83\93\82Í\83R\83\81\83\93\83g\88µ\82¢\82Å\96³\8e\8b\82·\82é
+                if AnsiPos('>>', argline) <> 1 then begin
+                               bufstl.Append(argline);
+                end;
                        end;
                        ret := bufstl.Count;
                        SetLength(Ftokens[index],ret);
@@ -448,6 +455,9 @@ begin
                trgLen := Length(target);
 
                for lines := 0 to High(Ftokens) do begin
+            if Length(Ftokens[lines]) = 0 then begin
+                Continue;
+            end;
                        hit := true;
                        bufline := target;
                        pts := PChar(bufline);
@@ -905,6 +915,32 @@ begin
        Result := Result + AString;
 end;
 
+// NG\83\8f\81[\83h\83t\83@\83C\83\8b\82É\92Ç\89Á \92Ç\89Á\82³\82ê\82½\8fê\8d\87\81ATrue\82ª\82©\82¦\82é
+function TAbon.AddToken(AString: string; Invisible: Boolean): Boolean;
+var
+       bufStringList : TStringList;
+    ngword: String;
+begin
+    Result := False;
+    if FileExists(GetNGwordpath) then begin
+        bufStringList := TStringList.Create;
+        try
+            bufStringList.LoadFromFile(GetNGwordpath);
+            if (Invisible) then begin
+                ngword := #9 + AString;
+            end else begin
+                ngword := AString;
+            end;
+            if (bufStringList.IndexOf(ngword) = -1) then begin
+                bufStringList.Add(ngword);
+                bufStringList.SaveToFile(GetNGwordpath);
+                Result := True;
+            end;
+        finally
+            bufStringList.Free;
+        end;
+    end;
+end;
 
 
 end.