OSDN Git Service

Add git diff support at gitdll
[tortoisegit/TortoiseGitJp.git] / ext / gitdll / gitdll.h
1 // The following ifdef block is the standard way of creating macros which make exporting \r
2 // from a DLL simpler. All files within this DLL are compiled with the GITDLL_EXPORTS\r
3 // symbol defined on the command line. this symbol should not be defined on any project\r
4 // that uses this DLL. This way any other project whose source files include this file see \r
5 // GITDLL_API functions as being imported from a DLL, whereas this DLL sees symbols\r
6 // defined with this macro as being exported.\r
7 #ifdef __cplusplus\r
8 #define EXTERN extern "C"\r
9 #else\r
10 #define EXTERN\r
11 #endif\r
12 \r
13 #ifdef GITDLL_EXPORTS\r
14 #define GITDLL_API __declspec(dllexport) EXTERN\r
15 #else\r
16 #define GITDLL_API __declspec(dllimport) EXTERN\r
17 #endif\r
18 \r
19 #if 0\r
20 // This class is exported from the gitdll.dll\r
21 class GITDLL_API Cgitdll {\r
22 public:\r
23         Cgitdll(void);\r
24         // TODO: add your methods here.\r
25 };\r
26 #endif\r
27 \r
28 #define GIT_HASH_SIZE 20\r
29 \r
30 typedef unsigned char GIT_HASH[GIT_HASH_SIZE];\r
31 typedef unsigned int  GIT_HANDLE;\r
32 typedef unsigned int  GIT_LOG;\r
33 \r
34 typedef unsigned int GIT_DIFF;\r
35 typedef unsigned int GIT_FILE;\r
36 \r
37 struct GIT_COMMIT_AUTHOR\r
38 {\r
39         char *Name;\r
40         int       NameSize;\r
41         char *Email;\r
42         int       EmailSize;\r
43         int       Date;\r
44         int   TimeZone;\r
45         \r
46 };\r
47 typedef struct GIT_COMMIT_DATA\r
48 {\r
49         GIT_HASH m_hash;\r
50         struct GIT_COMMIT_AUTHOR m_Author;\r
51         struct GIT_COMMIT_AUTHOR m_Committer;\r
52         char *   m_Subject;\r
53         int              m_SubjectSize;\r
54         char *   m_Body;\r
55         int              m_BodySize;\r
56         void *   m_pGitCommit; /** internal used */\r
57 \r
58 } GIT_COMMIT;\r
59 \r
60 \r
61 GITDLL_API int ngitdll;\r
62 \r
63 GITDLL_API int fngitdll(void);\r
64 /**\r
65  *      Get Git Last Error string. \r
66  */\r
67 GITDLL_API char * get_git_last_error();\r
68 /**\r
69  *      Get hash value. \r
70  *      @param  name    [IN] Reference name, such as HEAD, master, ...\r
71  *      @param  sha1    [OUT] char[20] hash value. Caller prepare char[20] buffer.\r
72  *      @return                 0       success. \r
73  */\r
74 GITDLL_API int git_get_sha1(const char *name, GIT_HASH sha1);\r
75 /**\r
76  *      Init git dll\r
77  *  @remark, this function must be call before other function. \r
78  *      @return                 0       success\r
79  */\r
80 GITDLL_API int git_init();\r
81 \r
82 GITDLL_API int git_open_log(GIT_LOG * handle, char * arg);\r
83 GITDLL_API int git_get_log_firstcommit(GIT_LOG handle);\r
84 \r
85 /**\r
86  *      Get Next Commit\r
87  *  @param handle       [IN]handle  Get handle from git_open_log\r
88  *      @param commit   [OUT]commit     Caller need prepare buffer for this call\r
89  *  @return                     0       success\r
90  *      @remark                 Caller need call git_free_commit to free internal buffer after use it;\r
91  */\r
92 GITDLL_API int git_get_log_nextcommit(GIT_LOG handle, GIT_COMMIT *commit);\r
93 \r
94 GITDLL_API int git_close_log(GIT_LOG handle);\r
95 \r
96 /**\r
97  *      Get Commit information from commit hash\r
98  *      @param  commit  [OUT] output commit information\r
99  *  @param      hash    [in] hash \r
100  *      @return         0       success\r
101  */\r
102 GITDLL_API int git_get_commit_from_hash(GIT_COMMIT *commit, GIT_HASH hash);\r
103 GITDLL_API int git_parse_commit(GIT_COMMIT *commit);\r
104 GITDLL_API int git_free_commit(GIT_COMMIT *commit);\r
105 \r
106 GITDLL_API int git_open_diff(GIT_DIFF *diff, char * arg);\r
107 GITDLL_API int git_diff(GIT_DIFF diff, GIT_HASH hash1,GIT_HASH hash2);\r
108 GITDLL_API int git_close_diff(GIT_DIFF diff);\r
109 \r
110 GITDLL_API int git_get_diff_firstfile(GIT_DIFF diff, GIT_FILE * file);\r
111 GITDLL_API int git_get_diff_nextfile(GIT_DIFF diff, GIT_FILE *file);\r
112 GITDLL_API int git_get_diff_status(GIT_DIFF diff, int * status);\r
113 GITDLL_API int git_get_diff_stat(GIT_FILE file, int *inc, int *dec, int *mode);\r
114 GITDLL_API int git_get_diff_file(GIT_FILE file, char *newname, int newsize,  char *oldname, int oldsize, int *mode);