libplugin.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __LIBPLUGIN_H__
00019 #define __LIBPLUGIN_H__
00020
00021
00022 #include <gtk/gtk.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031 #define FILE_VERSION "version"
00032 #define FILE_VERSION2 "version2"
00033 #define FILE_VERSION2_CR "version2\n"
00034
00035
00036 typedef struct {
00037 unsigned char Offset[4];
00038 unsigned char attrib;
00039 unsigned char unique_ID[3];
00040 } record_header;
00041
00042 typedef struct {
00043 unsigned long header_len;
00044 unsigned long header_version;
00045 unsigned long rec_len;
00046 unsigned long unique_id;
00047 unsigned long rt;
00048 unsigned char attrib;
00049 } PC3RecordHeader;
00050
00051 typedef struct mem_rec_header_s {
00052 unsigned int rec_num;
00053 unsigned int offset;
00054 unsigned int unique_id;
00055 unsigned char attrib;
00056 struct mem_rec_header_s *next;
00057 } mem_rec_header;
00058
00059 typedef struct {
00060 unsigned char db_name[32];
00061 unsigned char flags[2];
00062 unsigned char version[2];
00063 unsigned char creation_time[4];
00064 unsigned char modification_time[4];
00065 unsigned char backup_time[4];
00066 unsigned char modification_number[4];
00067 unsigned char app_info_offset[4];
00068 unsigned char sort_info_offset[4];
00069 unsigned char type[4];
00070 unsigned char creator_id[4];
00071 unsigned char unique_id_seed[4];
00072 unsigned char next_record_list_id[4];
00073 unsigned char number_of_records[2];
00074 } RawDBHeader;
00075
00076 typedef struct {
00077 char db_name[32];
00078 unsigned int flags;
00079 unsigned int version;
00080 time_t creation_time;
00081 time_t modification_time;
00082 time_t backup_time;
00083 unsigned int modification_number;
00084 unsigned int app_info_offset;
00085 unsigned int sort_info_offset;
00086 char type[5];
00087 char creator_id[5];
00088 char unique_id_seed[5];
00089 unsigned int next_record_list_id;
00090 unsigned int number_of_records;
00091 } DBHeader;
00092
00093 int get_next_unique_pc_id(unsigned int *next_unique_id);
00094
00095
00096 #define CLEAR_FLAG 1
00097 #define CANCEL_FLAG 2
00098 #define DELETE_FLAG 3
00099 #define MODIFY_FLAG 4
00100 #define NEW_FLAG 5
00101
00102 #define CLIST_DEL_RED 0xCCCC;
00103 #define CLIST_DEL_GREEN 0xCCCC;
00104 #define CLIST_DEL_BLUE 0xCCCC;
00105 #define CLIST_NEW_RED 55000;
00106 #define CLIST_NEW_GREEN 55000;
00107 #define CLIST_NEW_BLUE 65535;
00108 #define CLIST_MOD_RED 55000;
00109 #define CLIST_MOD_GREEN 65535;
00110 #define CLIST_MOD_BLUE 65535;
00111
00112 #define LOG_DEBUG 1
00113 #define LOG_INFO 2
00114 #define LOG_WARN 4
00115 #define LOG_FATAL 8
00116 #define LOG_STDOUT 256
00117 #define LOG_FILE 512
00118 #define LOG_GUI 1024
00119
00120 #define JPILOT_EOF -7
00121
00122 int jpilot_logf(int level, char *format, ...);
00123 int jp_logf(int level, char *format, ...);
00124
00125
00126
00127
00128
00129 #define SPENT_PC_RECORD_BIT 256
00130
00131 typedef enum {
00132 PALM_REC = 100L,
00133 MODIFIED_PALM_REC = 101L,
00134 DELETED_PALM_REC = 102L,
00135 NEW_PC_REC = 103L,
00136 DELETED_PC_REC = SPENT_PC_RECORD_BIT + 104L,
00137 DELETED_DELETED_PALM_REC = SPENT_PC_RECORD_BIT + 105L
00138 } PCRecType;
00139
00140 typedef struct
00141 {
00142 PCRecType rt;
00143 unsigned int unique_id;
00144 unsigned char attrib;
00145 void *buf;
00146 int size;
00147 } buf_rec;
00148
00149 typedef struct
00150 {
00151 char *base_dir;
00152 int *major_version;
00153 int *minor_version;
00154 } jp_startup_info;
00155
00156 struct search_result
00157 {
00158 char *line;
00159 unsigned int unique_id;
00160 struct search_result *next;
00161 };
00162
00163
00164
00165 int plugin_get_name(char *name, int len);
00166 int plugin_get_menu_name(char *name, int len);
00167 int plugin_get_db_name(char *db_name, int len);
00168 int plugin_startup(jp_startup_info *info);
00169 int plugin_gui(GtkWidget *vbox, GtkWidget *hbox, unsigned int unique_id);
00170 int plugin_help(char **text, int *width, int *height);
00171 int plugin_gui_cleanup(void);
00172 int plugin_pre_sync(void);
00173 int plugin_sync(int sd);
00174 int plugin_search(char *search_string, int case_sense, struct search_result **sr);
00175 int plugin_post_sync(void);
00176 int plugin_exit_cleanup(void);
00177
00178
00179 extern void jp_init();
00180 extern FILE *jp_open_home_file(char *filename, char *mode);
00181
00182
00183 int jp_install_remove_line(int deleted_line);
00184
00185 int jp_install_append_line(char *line);
00186
00187
00188
00189
00190 int jp_get_app_info(char *DB_name, unsigned char **buf, int *buf_size);
00191
00192
00193
00194
00195 int jp_read_DB_files(char *DB_name, GList **records);
00196
00197
00198
00199
00200 int jp_delete_record(char *DB_name, buf_rec *br, int flag);
00201
00202
00203
00204 int jp_free_DB_records(GList **records);
00205
00206 int jp_pc_write(char *DB_name, buf_rec *br);
00207
00208 const char *jp_strstr(const char *haystack, const char *needle, int case_sense);
00209
00210 int read_header(FILE *pc_in, PC3RecordHeader *header);
00211
00212 int write_header(FILE *pc_out, PC3RecordHeader *header);
00213
00214
00215
00216
00217
00218 int rename_file(char *old_filename, char *new_filename);
00219 int unlink_file(char *filename);
00220
00221
00222
00223
00224 int get_app_info_size(FILE *in, int *size);
00225
00226 #endif
This file is part of the documentation for kpilot Library Version 3.2.2.