1 // TortoiseMerge - a Diff/Patch program
\r
3 // Copyright (C) 2006-2007 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "svn_diff.h"
\r
22 #include "svn_pools.h"
\r
25 * \ingroup TortoiseMerge
\r
26 * Handles diffs of single lines. Used for inline diffs.
\r
34 bool Diff(svn_diff_t** diff, LPCTSTR line1, int len1, LPCTSTR line2, int len2, bool bWordDiff);
\r
35 /** Checks if we really should show inline diffs.
\r
36 * Inline diffs are only useful if the two lines are not
\r
37 * completely different but at least a little bit similar.
\r
39 static bool ShowInlineDiff(svn_diff_t* diff);
\r
41 std::vector<std::wstring> m_line1tokens;
\r
42 std::vector<std::wstring> m_line2tokens;
\r
45 apr_pool_t * m_pool;
\r
46 apr_pool_t * m_subpool;
\r
48 unsigned long m_line1length;
\r
50 unsigned long m_line2length;
\r
51 unsigned long m_line1pos;
\r
52 unsigned long m_line2pos;
\r
56 static svn_error_t * datasource_open(void *baton, svn_diff_datasource_e datasource);
\r
57 static svn_error_t * datasource_close(void *baton, svn_diff_datasource_e datasource);
\r
58 static svn_error_t * next_token(apr_uint32_t * hash, void ** token, void * baton, svn_diff_datasource_e datasource);
\r
59 static svn_error_t * compare_token(void * baton, void * token1, void * token2, int * compare);
\r
60 static void discard_token(void * baton, void * token);
\r
61 static void discard_all_token(void *baton);
\r
62 static bool IsCharWhiteSpace(TCHAR c);
\r
64 static apr_uint32_t Adler32(apr_uint32_t checksum, const WCHAR *data, apr_size_t len);
\r
65 static void ParseLineWords(
\r
66 LPCTSTR line, unsigned long lineLength, std::vector<std::wstring>& tokens);
\r
67 static void ParseLineChars(
\r
68 LPCTSTR line, unsigned long lineLength, std::vector<std::wstring>& tokens);
\r
69 static void NextTokenWords(
\r
70 apr_uint32_t* hash, void** token, unsigned long& linePos, const std::vector<std::wstring>& tokens);
\r
71 static void NextTokenChars(
\r
72 apr_uint32_t* hash, void** token, unsigned long& linePos, LPCTSTR line, unsigned long lineLength);
\r
73 static const svn_diff_fns_t SVNLineDiff_vtable;
\r