Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/AbonUnit.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.37.4.1 by h677, Sat Jul 2 04:09:23 2005 UTC revision 1.37.4.2 by h677, Sun Jul 3 14:37:18 2005 UTC
# Line 802  begin Line 802  begin
802  end;  end;
803  //シリア語ブラクラ対策  //シリア語ブラクラ対策
804  function TAbon.TreatSyria(AString: string): string;  function TAbon.TreatSyria(AString: string): string;
805    const
806            UNI_TAG = '&#';
807  var  var
808          //count: Integer; //(&#1792~&#1871)          //count: Integer; //(&#1792~&#1871)
809          pos: Integer;          ps : PChar;
810          tmp: string;          p, pe, s, se : PChar;
811            scode: String;
812            icode: Integer;
813  begin  begin
814          tmp := '';  
815          pos := AnsiPos('&#18', AString);          Result := '';
816          while pos <> 0  do begin  
817                  tmp := tmp + Copy(AString, 1, pos - 1);          p := PChar(AString);
818                  Delete(AString, 1, pos -1);          pe := p + Length(AString);
819                  if StrToIntDef(Copy(AString, 4, 2), -1) > 0 then begin          s := PChar(UNI_TAG);
820                          if (AString[7] = ';' )  or (AString[7] = ' ') then begin          se := s + Length(UNI_TAG);
821                                  Delete(AString, 1, 7);  
822                          end else if StrToIntDef(AString[7], -1) = -1 then begin          p := AnsiStrPosEx(p, pe, s, se);
823                                  Delete(AString, 1, 6);  
824                          end else begin          while p <> nil do begin
825                                  tmp := tmp + Copy(AString, 1, 6);                  //&#の手前までコピーする
826                                  Delete(AString, 1, 6);                  Result := Result + Copy(AString, 1, p - PChar(AString));
827                          end;                  //&#の手前まで削除する
828                  end else begin                  Delete(AString, 1, p - PChar(AString));
829                          tmp := tmp + Copy(AString, 1, 7);  
830                          Delete(AString, 1, 7);                  //AStringに3文字以上あれば次の3文字目をチェック
831                  end;                  if Length(AString) > 2 then begin
832                  pos := AnsiPos('&#18', AString);                          ps := PChar(AString) + 2;
833          end;                          if (ps^ = 'x') or (ps^ = 'X') then begin
834          if Length(AString) > 0 then                                  //16進表記
835                  tmp := tmp + AString;                                  Inc(ps);
836          AString := tmp;                                  scode := '0x';
837          tmp := '';                                  while ((ps^ >= '0') and (ps^ <= '9')) or
838                                            ((ps^ >= 'a') and (ps^ <= 'f')) or
839          pos := AnsiPos('&#179', AString);                                          ((ps^ >= 'A') and (ps^ <= 'F')) do begin
840          while pos <> 0 do begin                                          
841                  tmp := tmp + Copy(AString, 1, pos - 1);                                          scode := scode + String(ps^);
842                  Delete(AString, 1, pos - 1);                                          Inc(ps);
843                  if StrToIntDef(Copy(AString, 6, 1), 0) > 2 then begin                                  end;
                         if (AString[7] = ';') or (AString[7] = ' ') then begin  
                                 Delete(AString, 1, 7);  
                         end else if StrToIntDef(AString[7], -1) = -1 then begin  
                                 Delete(AString, 1, 6);  
844                          end else begin                          end else begin
845                                  tmp := tmp + Copy(AString, 1, 5);                                  //10進表記
846                                  Delete(AString, 1, 5);                                  scode := '';
847                                    while ((ps^ >= '0') and (ps^ <= '9')) do begin
848                                            scode := scode + String(ps^);
849                                            Inc(ps);
850                                    end;
851                          end;                          end;
852                            icode := StrToIntDef(scode, 0);
853    
854                            //最後が;で閉じていなければ、一文字前までにする
855                            if not (ps^ = ';') then
856                                    Dec(ps);
857    
858                            //シリア語ブラクラのでない
859                            if (icode <1792) or (icode > 1871) then
860                                    Result := Result + Copy(AString, 1, ps - PChar(AString) + 1);
861    
862                            Delete(AString, 1, ps - PChar(AString) + 1);
863                  end else begin                  end else begin
864                          tmp := tmp + Copy(AString, 1, 5);              //後ろに文字が無いので、そのままResultに突っ込む
865                          Delete(AString, 1, 5);                          Result := Result + AString;
866                            AString := '';
867                  end;                  end;
868                  pos := AnsiPos('&#179', AString);                  p := PChar(AString);
869                    pe := p + Length(AString);
870                    p := AnsiStrPosEx(p, pe, s, se);
871          end;          end;
872          if Length(AString) > 0 then  
873                  tmp := tmp + AString;      //残った文字列を足して結果にする
874          Result := tmp;          Result := Result + AString;
875  end;  end;
876    
877    

Legend:
Removed from v.1.37.4.1  
changed lines
  Added in v.1.37.4.2

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26