Index . 블로그창고 . Any comments?

\cat palm, software

Database structures for Palm OS 5 PIM software

The following header files are released under (C) 2007 GPL by Huidae Cho. The pilot-link project helped me better understand the schemas of old PIM databases.

This analysis is not yet complete.

CalendarDB-PDat
ContactsDB-PAdd
MemosDB-PMem
TasksDB-PTod
npadDB

CalendarDB-PDat

/* DB schemas for Palm OS 5 PIM software
 * (C) 2007 GPL by Huidae Cho
 */
#ifndef _DATE_H_
#define _DATE_H_

#define alarmFlag(a) ((a)[6] & 0x40)
#define repeatFlag(a) ((a)[6] & 0x20)
#define noteFlag(a) ((a)[6] & 0x10)
#define exceptionsFlag(a) ((a)[6] & 0x08)
#define descriptionFlag(a) ((a)[6] & 0x04)
#define locationFlag(a) ((a)[6] & 0x02)

#define setAlarmFlag(a) (a)[6] |= 0x40
#define setRepeatFlag(a) (a)[6] |= 0x20
#define setNoteFlag(a) (a)[6] |= 0x10
#define setExceptionsFlag(a) (a)[6] |= 0x08
#define setDescriptionFlag(a) (a)[6] |= 0x04
#define setLocationFlag(a) (a)[6] |= 0x02

#define headerSize1(a) (8+(alarmFlag(a)?2:0)+(repeatFlag(a)?8:0))
#define exceptionsCount(a) (exceptionsFlag(a)? \
		UInt8sToUInt16((a)[headerSize1(a)], (a)[headerSize1(a)+1]):0)
#define headerSize(a) (headerSize1(a)+exceptionsCount(a)*2)

#ifdef _DEFINE_VARS_
/* old/new pim header: variable length */
UInt8 hdr[] = { /* 8 + 2 * exceptions <= size <= 18 + 2 * exceptions */
	0xff, /* 0: start time hours */
	0xff, /* 1: start time minutes */
	0xff, /* 2: end time hours */
	0xff, /* 3: end time minutes */
	/* packed = ((year-1904)<<9)|(month<<5)|day; */
	0x00, /* 4: packed>>8 */
	0x00, /* 5: packed&0xff */
	0x04, /* 6: when alarm repeat note exceptions description location ? */
	0x00, /* 7: gap fill */
};
/* if(alarm){ 2 bytes
 * 	alarm: 1 byte
 * 	earlier units: 1 byte: 0 minutes, 1 hours, 2 days
 * }
 * if(repeat){ 8 bytes
 * 	type: 1 byte, 0 none, 1 daily, 2 weekly, 3 monthly by day,
 * 	      4 monthly by date, 5 yearly
 * 	0x00
 * 	end date: 2 bytes, 0xffff forever
 * 	frequency: 1 byte
 * 	day of week bits: 1 byte
 * 	repeat week start: 1 byte
 * 	0x00
 * }
 * if(exceptions){ 2 + 2 * count bytes
 * 	count: 2 bytes
 * 	count * exception date: 2 * count bytes
 * }
 *******************************************************************************
 * if(description)
 * 	description
 * if(note)
 * 	note
 * if(location)
 * 	location
 */
/* new pim footer for untimed events: fixed length */
UInt8 ftrNew[] = {
	0x42,
	0x64,
	0x30,
	0x31,
	0x00,
	0x04,
	0x00,
	0x01,
	0x00,
	0x00,
};
#endif

#endif

ContactsDB-PAdd

/* DB schemas for Palm OS 5 PIM software
 * (C) 2007 GPL by Huidae Cho
 */
#ifndef _ADDR_H_
#define _ADDR_H_

#define oldLastNameFlag(a) ((a)[7] & 0x1)
#define oldFirstNameFlag(a) ((a)[7] & 0x2)
#define oldCompanyFlag(a) ((a)[7] & 0x4)

#define setOldLastNameFlag(a) (a)[7] |= 0x1
#define setOldFirstNameFlag(a) (a)[7] |= 0x2
#define setOldCompanyFlag(a) (a)[7] |= 0x4

#define lastNameFlag(a) ((a)[11] & 0x1)
#define firstNameFlag(a) ((a)[11] & 0x2)
#define companyFlag(a) ((a)[11] & 0x4)

#define setLastNameFlag(a) (a)[11] |= 0x1
#define setFirstNameFlag(a) (a)[11] |= 0x2
#define setCompanyFlag(a) (a)[11] |= 0x4

#ifdef _DEFINE_VARS_
/* old pim header: fixed length */
UInt8 hdrOld[] = {
	0x00, /* 0: reserved */
	0x05, /* 1: displayPhoneForList, phone5 */
	0x47, /* 2: phone4, phone3 */
	0x10, /* 3: phone2, phone1 */
	0x00, /* 4: reserved */
	0x00, /* 5: reserved[5], note ... custom3 */
	0x00, /* 6: custom2 ... address */
	0x01, /* 7: phone5 ... name */
	0x00, /* 8: companyFieldOffset */
};
/* new pim header: fixed length */
UInt8 hdrNew[] = {
	0x03, /* 0 */
	0x65, /* 1: messanger, phone5 */
	0x47, /* 2: phone4, phone3 */
	0x10, /* 3: phone2, phone1 */
	0x02, /* 4 */
	0x10, /* 5 */
	0x00, /* 6 */
	0x21, /* 7: b0-3: 0 IM, 1 AIM, 2 MSN, 3 Yahoo, 4 AOL ICQ */
	0x00, /* 8 */
	0x00, /* 9 */
	0x00, /* 10 */
	0x01, /* 11: b0 last name, 1 first name, 2 company, 3 title */
	0x00, /* 12 */
	0x00, /* 13 */
	0x00, /* 14 */
	0x00, /* 15 */
	0x00, /* 16 */
};
/* field records */
#endif

#endif

MemosDB-PMem

String terminated with '\0'.

TasksDB-PTod

/* DB schemas for Palm OS 5 PIM software
 * (C) 2007 GPL by Huidae Cho
 */
#ifndef _TODO_H_
#define _TODO_H_

#ifdef _DEFINE_VARS_
/* old pim header: fixed length */
UInt8 hdrOld[] = {
	/* packed = ((year-1904)<<9)|(month<<5)|day; */
	/* 0xffff: no date */
	0xff, /* packed>>8 */
	0xff, /* packed&0xff */
	0x01, /* 7: complete flag, 3-0: priority */
};
#endif

#define dueDateFlag(a) ((a)[0] & 0x80)
#define completionDateFlag(a) ((a)[0] & 0x40)
#define alarmFlag(a) ((a)[0] & 0x20)
#define repeatFlag(a) ((a)[0] & 0x10)
#define completedFlag(a) ((a)[3] & 0x01)
#define priorityFlag(a) ((a)[5] & 0x0f)

#define setDueDateFlag(a) (a)[0] |= 0x80
#define setCompletionDateFlag(a) (a)[0] |= 0x40
#define setAlarmFlag(a) (a)[0] |= 0x20
#define setRepeatFlag(a) (a)[0] |= 0x10
#define setCompletedFlag(a) (a)[3] |= 0x01
#define setPriorityFlag(a) (a)[5] |= 0x0f

#define headerSize(a) (6+(dueDateFlag(a)?2:0)+(completionDateFlag(a)?2:0)+ \
		(alarmFlag(a)?4:0)+(repeatFlag(a)?10:0))

#ifdef _DEFINE_VARS_
/* new pim header: variable length */
UInt8 hdrNew[] = { /* 6 <= size <= 24 */
	0x08, /* 0: b7 due date, b6 completion date: if(repeat) always set
		    after completion, b5 alarm, b4 repeat */
	0x00, /* 1 */
	0x00, /* 2 */
	0x00, /* 3: b0: completed */
	0x00, /* 4 */
	0x01, /* 5: b0-2: priority */
	/* optional:
	 * if(due date){ 2 <= size <= 18
	 * 	due date: 2 bytes
	 * 	if(completion date) 2 bytes
	 * 		completion date: 2 bytes
	 * 	if(alarm){ 4 bytes
	 * 		hour: 1 byte
	 * 		min: 1 byte
	 * 		0x00
	 * 		days earlier: 1 byte
	 * 	}
	 * 	if(repeat){ 10 bytes
	 * 		TODO
	 * 		repeat start date: 2 bytes
	 * 		0x01 0x00
	 * 		repeat end date: 2 bytes
	 * 		0x01 0x00
	 * 		0x00 0x00
	 * 	}
	 * }else
	 * if(completion date) 2 bytes
	 * 	completion date: 2 bytes
	 */
};
/* description
 * note
 */
#endif

#endif

npadDB

/* DB schemas for Palm OS 5 PIM software
 * (C) 2007 GPL by Huidae Cho
 */
#ifndef _NOTE_H_
#define _NOTE_H_

#define alarmFlag(a) ((a)[29] & 0x04)
#define descriptionFlag(a) ((a)[29] & 0x02)
#define noteFlag(a) ((a)[29] & 0x01)

#define setAlarmFlag(a) (a)[29] |= 0x04
#define setDescriptionFlag(a) (a)[29] |= 0x02
#define setNoteFlag(a) (a)[29] |= 0x01

#define headerSize(a) (30+(alarmFlag(a)?14:0))

#ifdef _DEFINE_VARS_
/* header: variable length */
UInt8 hdr[] = { /* 8 + 2 * exceptions <= size <= 18 + 2 * exceptions */
	0x00, /* 0 */
	0x00, /* 1: created time second */
	0x00, /* 2 */
	0x00, /* 3: created time minute */
	0x00, /* 4 */
	0x00, /* 5: created time hour */
	0x00, /* 6 */
	0x00, /* 7: created time day */
	0x00, /* 8 */
	0x00, /* 9: created time month */
	0x00, /* 10: created time year (hi byte) */
	0x00, /* 11: created time year (low byte) */
	0x00, /* 12 */
	0x06, /* 13 */
	0x00, /* 14 */
	0x00, /* 15: modified time seconds */
	0x00, /* 16 */
	0x00, /* 17: modified time minutes */
	0x00, /* 18 */
	0x00, /* 19: modified time hours */
	0x00, /* 20 */
	0x00, /* 21: modified time day */
	0x00, /* 22 */
	0x00, /* 23: modified time month */
	0x00, /* 24: modified time year(1) */
	0x00, /* 25: modified time year(2) */
	0x00, /* 26 */
	0x06, /* 27 */
	0x00, /* 28 */
	0x02, /* 29: ? ? ? ? ? alarm description note */
};
/* if(alarm){ 14 bytes
 * 	0
 * 	1: created time seconds
 * 	2
 * 	3: created time minutes
 * 	4
 * 	5: created time hours
 * 	6
 * 	7: created time day
 * 	8
 * 	9: created time month
 * 	10: created time year(1)
 * 	11: created time year(2)
 * 	12
 * 	13
 * }
 * if(description)
 * 	description
 * if(note)
 * 	note
 */
#endif

#endif

All the works in this site except software and copyrighted materials by others (e.g., 문학) are licensed under a Creative Commons License. 소프트웨어 및 문학과 같이 다른 이에게 저작권이 있는 작품을 제외하고 모두 크리에이티브 커먼즈 라이센스를 따른다.
Tue Oct 13 15:14:03 2020 . XHTML . CSS (lightbox.css is not part of Uniqki. ;-) . Powered by Uniqki!
refresh . edit . loginout . index