OSDN Git Service

1.58.0.762
[gikonavigoeson/gikonavi.git] / AbonUnit.pas
index d46ebed..7ed4958 100644 (file)
@@ -114,6 +114,8 @@ type
        function GoBack() : Boolean; //List\82Ì\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
        //--
        function TreatSyria(AString: string): string;
+    //--
+    function AddToken(AString: string; Invisible: Boolean): Boolean;
   end;
 var
        Abon1 :TAbon;
@@ -374,7 +376,6 @@ var
        pos : Integer;
        buftoken : String;
 begin
-       pos := 0;
        bufstl := TStringList.Create;
        try
                if Length(argline) > 0 then begin
@@ -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);
@@ -884,8 +894,11 @@ begin
                                Dec(ps);
 
                        //\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\82Ì\82Å\82È\82¢
-                       if (icode <1792) or (icode > 1871) then
-                               Result := Result + Copy(AString, 1, ps - PChar(AString) + 1);
+            if ( icode < 1758) or
+                ((icode > 1871) and (icode < 1958)) or
+                (icode > 1968) then begin
+                Result := Result + Copy(AString, 1, ps - PChar(AString) + 1);
+            end;
 
                        Delete(AString, 1, ps - PChar(AString) + 1);
                end else begin
@@ -902,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.