OSDN Git Service

merge original branch.
[tortoisegit/TortoiseGitJp.git] / ext / gitdll / gitdll.h
index 2b83be8..3552e32 100644 (file)
@@ -4,6 +4,9 @@
 // that uses this DLL. This way any other project whose source files include this file see \r
 // GITDLL_API functions as being imported from a DLL, whereas this DLL sees symbols\r
 // defined with this macro as being exported.\r
+#ifndef __GITDLL__\r
+#define __GITDLL__\r
+\r
 #ifdef __cplusplus\r
 #define EXTERN extern "C"\r
 #else\r
@@ -11,9 +14,9 @@
 #endif\r
 \r
 #ifdef GITDLL_EXPORTS\r
-#define GITDLL_API __declspec(dllexport) EXTERN\r
+#define GITDLL_API EXTERN __declspec(dllexport) \r
 #else\r
-#define GITDLL_API __declspec(dllimport) EXTERN\r
+#define GITDLL_API EXTERN __declspec(dllimport) \r
 #endif\r
 \r
 #if 0\r
@@ -25,9 +28,100 @@ public:
 };\r
 #endif\r
 \r
+#define GIT_HASH_SIZE 20\r
+\r
+typedef unsigned char GIT_HASH[GIT_HASH_SIZE];\r
+\r
+typedef void *  GIT_HANDLE;\r
+typedef void *  GIT_LOG;\r
+\r
+typedef void * GIT_DIFF;\r
+typedef void * GIT_FILE;\r
+typedef void * GIT_COMMIT_LIST;\r
+\r
+struct GIT_COMMIT_AUTHOR\r
+{\r
+       char *Name;\r
+       int       NameSize;\r
+       char *Email;\r
+       int       EmailSize;\r
+       int       Date;\r
+       int   TimeZone;\r
+       \r
+};\r
+typedef struct GIT_COMMIT_DATA\r
+{\r
+       GIT_HASH m_hash;\r
+       struct GIT_COMMIT_AUTHOR m_Author;\r
+       struct GIT_COMMIT_AUTHOR m_Committer;\r
+       char *   m_Subject;\r
+       int              m_SubjectSize;\r
+       char *   m_Body;\r
+       int              m_BodySize;\r
+       void *   m_pGitCommit; /** internal used */\r
+       char *   m_Encode;\r
+       int              m_EncodeSize;\r
+\r
+} GIT_COMMIT;\r
+\r
+\r
 GITDLL_API int ngitdll;\r
 \r
 GITDLL_API int fngitdll(void);\r
-\r
+/**\r
+ *     Get Git Last Error string. \r
+ */\r
 GITDLL_API char * get_git_last_error();\r
-GITDLL_API int git_get_sha1(const char *name, unsigned char *sha1);
\ No newline at end of file
+/**\r
+ *     Get hash value. \r
+ *     @param  name    [IN] Reference name, such as HEAD, master, ...\r
+ *     @param  sha1    [OUT] char[20] hash value. Caller prepare char[20] buffer.\r
+ *     @return                 0       success. \r
+ */\r
+GITDLL_API int git_get_sha1(const char *name, GIT_HASH sha1);\r
+/**\r
+ *     Init git dll\r
+ *  @remark, this function must be call before other function. \r
+ *     @return                 0       success\r
+ */\r
+GITDLL_API int git_init();\r
+\r
+GITDLL_API int git_open_log(GIT_LOG * handle, char * arg);\r
+GITDLL_API int git_get_log_firstcommit(GIT_LOG handle);\r
+GITDLL_API int git_get_log_estimate_commit_count(GIT_LOG handle);\r
+\r
+/**\r
+ *     Get Next Commit\r
+ *  @param handle      [IN]handle  Get handle from git_open_log\r
+ *     @param commit   [OUT]commit     Caller need prepare buffer for this call\r
+ *  @return                    0       success\r
+ *     @remark                 Caller need call git_free_commit to free internal buffer after use it;\r
+ */\r
+GITDLL_API int git_get_log_nextcommit(GIT_LOG handle, GIT_COMMIT *commit);\r
+\r
+GITDLL_API int git_close_log(GIT_LOG handle);\r
+\r
+/**\r
+ *     Get Commit information from commit hash\r
+ *     @param  commit  [OUT] output commit information\r
+ *  @param     hash    [in] hash \r
+ *     @return         0       success\r
+ */\r
+GITDLL_API int git_get_commit_from_hash(GIT_COMMIT *commit, GIT_HASH hash);\r
+GITDLL_API int git_parse_commit(GIT_COMMIT *commit);\r
+\r
+GITDLL_API int git_get_commit_first_parent(GIT_COMMIT *commit,GIT_COMMIT_LIST *list);\r
+GITDLL_API int git_get_commit_next_parent(GIT_COMMIT_LIST *list, GIT_HASH hash);\r
+\r
+GITDLL_API int git_free_commit(GIT_COMMIT *commit);\r
+\r
+GITDLL_API int git_open_diff(GIT_DIFF *diff, char * arg);\r
+GITDLL_API int git_diff(GIT_DIFF diff, GIT_HASH hash1,GIT_HASH hash2, GIT_FILE * file, int *count);\r
+GITDLL_API int git_root_diff(GIT_DIFF diff, GIT_HASH hash,GIT_FILE *file, int *count);\r
+GITDLL_API int git_diff_flush(GIT_DIFF diff);\r
+GITDLL_API int git_close_diff(GIT_DIFF diff);\r
+\r
+\r
+GITDLL_API int git_get_diff_file(GIT_DIFF diff,GIT_FILE file, int i,char **newname, char **oldname,  int *mode, int *IsBin, int *inc, int *dec);\r
+\r
+#endif
\ No newline at end of file