You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(56) |
Jul
(101) |
Aug
(14) |
Sep
|
Oct
(1) |
Nov
|
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(106) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
(7) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ny...@us...> - 2006-12-25 14:34:05
|
Revision: 200 http://svn.sourceforge.net/pmplib/?rev=200&view=rev Author: nyaochi Date: 2006-12-25 06:33:57 -0800 (Mon, 25 Dec 2006) Log Message: ----------- Implemented a record constructor for db.dat. Not tested yet. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-25 14:33:57 UTC (rev 200) @@ -39,6 +39,7 @@ #include <stdlib.h> #include <memory.h> #include <ucs2char.h> +#include <filepath.h> #include "serialize.h" #include "util.h" @@ -139,6 +140,12 @@ memset(list, 0, sizeof(*list)); } +static dat_entry_t *dat_list_expand(dat_list_t* list) +{ + list->entries = (dat_entry_t*)realloc(list->entries, sizeof(dat_entry_t) * (list->num_entries+1)); + return &list->entries[list->num_entries++]; +} + static void dat_list_finish(dat_list_t* list) { uint32_t i; @@ -230,3 +237,160 @@ dat_list_dump(&dat->musics, &dic->music, fp); fprintf(fp, "}\n"); } + +static int comp_pathname(const void *__x, const void *__y) +{ + const ip3db_sort_index_t* _x = (const ip3db_sort_index_t*)__x; + const ip3db_sort_index_t* _y = (const ip3db_sort_index_t*)__y; + const ip3db_variant_t* x = _x->base[_x->index]; + const ip3db_variant_t* y = _y->base[_y->index]; + int ret = ucs2cmp(x[IP3DBF_MUSIC_FILEPATH].value.str, y[IP3DBF_MUSIC_FILEPATH].value.str); + if (ret == 0) { + return ucs2cmp(x[IP3DBF_MUSIC_FILENAME].value.str, y[IP3DBF_MUSIC_FILENAME].value.str); + } else { + return ret; + } +} + +typedef struct { + ucs2char_t* path; + uint32_t uid; +} dircache_element_t; + +typedef struct { + int max_elems; + int num_elems; + dircache_element_t* elems; +} dircache_t; + +static void dircache_init(dircache_t* dc) +{ + memset(dc, 0, sizeof(*dc)); +} + +static void dircache_push(dircache_t* dc, const ucs2char_t* path, uint32_t uid) +{ + dircache_element_t* elem = NULL; + + if (dc->max_elems < dc->num_elems + 1) { + dc->elems = (dircache_element_t*)realloc(dc->elems, sizeof(dircache_element_t) * (dc->max_elems+1)); + memset(&dc->elems[dc->max_elems], 0, sizeof(dircache_element_t)); + ++dc->max_elems; + } + + elem = &dc->elems[dc->num_elems++]; + ucs2free(elem->path); + elem->path = ucs2dup(path); + elem->uid = uid; +} + +static void dircache_pop(dircache_t* dc, int i) +{ + ++i; + for (;i < dc->num_elems;++i) { + ucs2free(dc->elems[i].path); + memset(&dc->elems[i], 0, sizeof(dc->elems[0])); + } +} + +static int dircache_findprefix(dircache_t* dc, const ucs2char_t* path) +{ + int i = dc->num_elems; + while (--i >= 0) { + if (ucs2ncmp(path, dc->elems[i].path, ucs2len(dc->elems[i].path)) == 0) { + break; + } + } + return i; +} + +static dircache_element_t *dircache_get(dircache_t* dc, int i) +{ + return &dc->elems[i]; +} + + +void dat_construct(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records) +{ + int i, j; + dat_entry_t* entry; + uint32_t uid = 0; + static const uint32_t uid_root = 0xFFFFFFFF; + static const ucs2char_t ucs2cs_object_root[] = {'/','a','/',0}; + static const ucs2char_t ucs2cs_root[] = {PATHCHAR, 0}; + dat_list_t* dato = &dat->objects; + dat_list_t* datm = &dat->musics; + dircache_t dc; + ip3db_sort_index_t *si = (ip3db_sort_index_t*)malloc(sizeof(ip3db_sort_index_t) * num_records); + + dircache_init(&dc); + + /* Clear all entries. */ + dat_list_finish(dato); + dat_list_finish(datm); + + /* Append an entry for the root directory. */ + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], ucs2cs_object_root); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid_root); + + /* Register the root node to the directory cache. */ + dircache_push(&dc, ucs2cs_root, uid_root); + + for (i = 0;i < num_records;++i) { + si[i].base = records; + si[i].index = i; + } + qsort(si, num_records, sizeof(si[0]), comp_pathname); + + for (i = 0;i < num_records;++i) { + const ip3db_variant_t* record = records[si[i].index]; + const ucs2char_t* path = record[IP3DBF_MUSIC_FILEPATH].value.str; + const ucs2char_t* file = record[IP3DBF_MUSIC_FILENAME].value.str; + int i = dircache_findprefix(&dc, path); + const dircache_element_t* com = dircache_get(&dc, i); + const ucs2char_t* p = path + ucs2len(com->path); + uint32_t puid = com->uid; + + dircache_pop(&dc, i); + + while (p && *p) { + ucs2char_t tmp[MAX_PATH]; + const ucs2char_t* q = filepath_skip_one_directory(p); + uid = dato->num_entries; + + ucs2ncpy(tmp, p, q-p); + tmp[q-p] = 0; + + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); + ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 1); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], tmp); + + ucs2ncpy(tmp, path, q-path); + tmp[q-path] = 0; + dircache_push(&dc, tmp, uid); + + puid = uid; + p = q; + } + + uid = dato->num_entries; + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); + ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 2); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], file); + + entry = dat_list_expand(datm); + dat_entry_init(entry, &dic->music); + for (j = 0;j < entry->num_fields;++j) { + ip3db_variant_clone(&entry->fields[j], &record[j]); + } + ip3db_variant_set_dword(&entry->fields[IP3DBF_MUSIC_UID], uid); + } +} Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-25 14:33:57 UTC (rev 200) @@ -49,4 +49,6 @@ size_t dat_serialize(dat_t* dat, const dic_t* dic, uint8_t* buffer, int is_storing); void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp); +void dat_construct(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records); + #endif/*__IP3DB_DAT_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-25 14:33:57 UTC (rev 200) @@ -64,6 +64,7 @@ {0, 0x0ACE, {IP3DBF_OBJECTS_FILETYPE, IP3DBF_OBJECTS_PARENTUID, IP3DBF_OBJECTS_PROPERTIES}}, }; + static void dic_field_init(dic_field_t* entry) { memset(entry, 0, sizeof(*entry)); @@ -186,9 +187,9 @@ void dic_dump(dic_t* dic, FILE *fp) { fprintf(fp, "===== db.dic =====\n"); - fprintf(fp, "MUSIC {\n"); + fprintf(fp, "MUSIC = {\n"); dic_table_dump(&dic->music, fp); - fprintf(fp, "OBJECTS {\n"); + fprintf(fp, "OBJECTS = {\n"); dic_table_dump(&dic->objects, fp); fprintf(fp, "\n"); } @@ -238,3 +239,191 @@ fprints(fp, "%s", tbl->fields[field].name); } } + +uint8_t *dic_get_template(long* size) +{ + static uint8_t dic_template[] = { + 0x00, 0x00, 0x0B, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xEA, 0x00, 0x00, 0x04, 0x6E, 0x00, 0x00, 0x09, 0x72, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x03, 0x52, + 0x00, 0x4D, 0x00, 0x75, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, + 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x65, 0x00, 0x6E, + 0x00, 0x72, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x54, 0x00, 0x69, 0x00, 0x74, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xBC, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, + 0x00, 0x65, 0x00, 0x50, 0x00, 0x61, 0x00, 0x74, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, + 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x75, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, + 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x00, 0x73, 0x00, 0x65, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, + 0x00, 0x6C, 0x00, 0x65, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x76, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, + 0x00, 0x72, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x4E, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x62, + 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8A, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x44, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x01, 0xA2, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x63, + 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, + 0x00, 0x75, 0x00, 0x72, 0x00, 0x63, 0x00, 0x68, 0x00, 0x61, 0x00, 0x73, 0x00, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x01, 0xEE, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x72, + 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, + 0x00, 0x53, 0x00, 0x74, 0x00, 0x61, 0x00, 0x74, 0x00, 0x75, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, + 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x2C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x69, + 0x00, 0x74, 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x68, 0x00, 0x61, 0x00, 0x6E, + 0x00, 0x67, 0x00, 0x65, 0x00, 0x64, 0x00, 0x46, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x67, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x7A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x75, + 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x57, 0x00, 0x41, 0x00, 0x56, 0x00, 0x45, 0x00, 0x43, + 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x02, 0x92, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6C, 0x00, 0x75, 0x00, 0x73, 0x00, 0x4D, + 0x00, 0x00, 0x00, 0x00, 0x02, 0xAA, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, + 0x00, 0x6C, 0x00, 0x75, 0x00, 0x73, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x02, 0xCE, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, + 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, 0x00, 0x50, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, + 0x02, 0xF8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x67, + 0x00, 0x52, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x61, 0x00, 0x73, 0x00, 0x65, 0x00, 0x44, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1C, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x41, + 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x61, + 0x00, 0x74, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6D, 0x00, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x84, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, + 0x00, 0x65, 0x00, 0x6E, 0x00, 0x72, 0x00, 0x65, 0x00, 0x00, 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, + 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x54, 0x00, 0x69, 0x00, 0x74, 0x00, 0x6C, + 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC2, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x41, + 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, + 0x00, 0x63, 0x00, 0x6B, 0x00, 0x4E, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, + 0x00, 0x00, 0x00, 0x00, 0x03, 0xF4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, + 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, + 0x00, 0x61, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x4E, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x65, + 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1A, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x54, + 0x00, 0x69, 0x00, 0x74, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3E, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x72, 0x00, 0x65, + 0x00, 0x00, 0x00, 0x54, 0x00, 0x69, 0x00, 0x74, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, + 0x00, 0x75, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6B, + 0x00, 0x4E, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, + 0x00, 0x00, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, + 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x50, 0x00, 0x61, 0x00, 0x74, 0x00, 0x68, 0x00, 0x00, + 0x00, 0x00, 0x04, 0xCE, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, + 0x00, 0x6C, 0x00, 0x65, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x04, 0xE8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, + 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00, 0x62, 0x00, 0x75, 0x00, 0x6D, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x65, + 0x00, 0x6E, 0x00, 0x72, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x32, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x56, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, + 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x57, 0x00, 0x69, 0x00, 0x64, + 0x00, 0x74, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x05, 0x7C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x48, + 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x9C, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, + 0x00, 0x6C, 0x00, 0x65, 0x00, 0x50, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0xBE, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, + 0x00, 0x6C, 0x00, 0x65, 0x00, 0x53, 0x00, 0x69, 0x00, 0x7A, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x05, 0xD6, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6C, 0x00, 0x75, + 0x00, 0x73, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x55, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x07, 0x36, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0E, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, + 0x00, 0x65, 0x00, 0x50, 0x00, 0x61, 0x00, 0x74, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x4A, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, + 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x62, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x69, 0x00, 0x64, 0x00, 0x74, 0x00, 0x68, + 0x00, 0x00, 0x00, 0x00, 0x06, 0x7C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0x96, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6D, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0xBA, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x57, + 0x00, 0x69, 0x00, 0x64, 0x00, 0x74, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0xE0, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, + 0x00, 0x65, 0x00, 0x48, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x61, + 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x50, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x22, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x61, + 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x53, 0x00, 0x69, 0x00, 0x7A, 0x00, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x55, + 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xD4, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x65, 0x00, 0x66, 0x00, 0x65, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x63, 0x00, 0x65, + 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x50, 0x00, 0x61, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x43, 0x00, 0x6C, + 0x00, 0x75, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x07, 0xB2, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x43, 0x00, 0x68, 0x00, 0x69, 0x00, 0x6C, + 0x00, 0x64, 0x00, 0x43, 0x00, 0x6C, 0x00, 0x75, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, + 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x61, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x69, + 0x00, 0x64, 0x00, 0x65, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x08, 0x24, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x53, + 0x00, 0x61, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, + 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x08, 0x4A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x42, 0x00, 0x69, 0x00, 0x74, + 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x08, 0x62, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x69, 0x00, 0x64, 0x00, 0x74, 0x00, 0x68, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x7C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x08, 0xA2, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x61, + 0x00, 0x6C, 0x00, 0x42, 0x00, 0x69, 0x00, 0x74, 0x00, 0x52, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x08, 0xC8, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, + 0x00, 0x69, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6F, 0x00, 0x42, 0x00, 0x69, 0x00, 0x74, 0x00, 0x52, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x09, 0x06, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x73, + 0x00, 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x54, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x73, + 0x00, 0x61, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x53, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6E, + 0x00, 0x64, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x09, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x00, 0x69, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6F, 0x00, 0x46, 0x00, 0x6F, + 0x00, 0x75, 0x00, 0x72, 0x00, 0x43, 0x00, 0x43, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, + 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x09, 0x5E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x57, 0x00, 0x41, 0x00, 0x56, + 0x00, 0x45, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x55, 0x00, 0x49, 0x00, 0x44, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x09, 0x9A, 0x00, 0x00, 0x0A, 0xCE, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x6A, + 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x09, 0xAE, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, + 0x09, 0xCE, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x61, 0x00, 0x72, + 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x55, 0x00, 0x69, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x09, 0xF0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, + 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x65, 0x00, 0x73, 0x00, 0x00, + 0x00, 0x00, 0x0A, 0x0E, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, + 0x00, 0x6C, 0x00, 0x65, 0x00, 0x54, 0x00, 0x79, 0x00, 0x70, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x6A, + 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x0A, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x61, + 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x53, 0x00, 0x69, 0x00, 0x7A, + 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x43, 0x00, 0x72, 0x00, 0x65, 0x00, 0x61, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x9A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x6F, 0x00, 0x77, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB4, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x55, 0x00, 0x4F, 0x00, 0x49, 0x00, 0x44, + 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x50, 0x00, 0x55, 0x00, 0x4F, 0x00, 0x49, 0x00, 0x44, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, + 0x00, 0x65, 0x00, 0x54, 0x00, 0x79, 0x00, 0x70, 0x00, 0x65, 0x00, 0x00, 0x00, 0x50, 0x00, 0x61, + 0x00, 0x72, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x55, 0x00, 0x69, 0x00, 0x64, 0x00, 0x00, + 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, + 0x00, 0x65, 0x00, 0x73, 0x00, 0x00, + }; + if (size) { + *size = sizeof(dic_template) / sizeof(dic_template[0]); + } + return dic_template; +} Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-25 14:33:57 UTC (rev 200) @@ -56,5 +56,6 @@ void dic_dump(dic_t* dic, FILE *fp); uint32_t dic_get_idxroot(dic_t* dic, int table, int index); void dic_repr_index(dic_t* dic, int table, int index, FILE *fp); +uint8_t *dic_get_template(long* size); #endif/*__IP3DB_DIC_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-25 14:33:57 UTC (rev 200) @@ -284,3 +284,4 @@ fprintf(fpo, "\n"); return 0; } + Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-25 14:33:57 UTC (rev 200) @@ -50,11 +50,66 @@ ip3db_variant_init(var, IP3DBVT_NONE); } +void ip3db_variant_set_byte(ip3db_variant_t* var, uint8_t val) +{ + var->type = IP3DBVT_BYTE; + var->value.byte = val; +} + +void ip3db_variant_set_word(ip3db_variant_t* var, uint16_t val) +{ + var->type = IP3DBVT_WORD; + var->value.word = val; +} + +void ip3db_variant_set_dword(ip3db_variant_t* var, uint32_t val) +{ + var->type = IP3DBVT_DWORD; + var->value.dword = val; +} + +void ip3db_variant_set_str(ip3db_variant_t* var, const ucs2char_t* val) +{ + var->type = IP3DBVT_STRING; + ucs2free(var->value.str); + var->value.str = ucs2dup(val); +} + +void ip3db_variant_clone(ip3db_variant_t* dst, const ip3db_variant_t* src) +{ + switch (dst->type = src->type) { + case IP3DBVT_BYTE: + dst->value.byte = src->value.byte; + break; + case IP3DBVT_WORD: + dst->value.word = src->value.word; + break; + case IP3DBVT_DWORD: + dst->value.dword = src->value.dword; + break; + case IP3DBVT_STRING: + ucs2free(dst->value.str); + if (src->value.str) { + dst->value.str = ucs2dup(src->value.str); + } else { + dst->value.str = 0; + } + break; + } +} + void ip3db_init(ip3db_t* db) { + uint8_t *dic_template = NULL; + memset(db, 0, sizeof(*db)); db->dat = dat_new(); db->dic = dic_new(); + + dic_template = dic_get_template(&db->dic_size); + db->dic_buffer = (uint8_t*)malloc(db->dic_size); + memcpy(db->dic_buffer, dic_template, db->dic_size); + dic_serialize(db->dic, db->dic_buffer, 0); } void ip3db_finish(ip3db_t* db) @@ -120,3 +175,26 @@ idx_dump(db->idx_buffer, db->dic, fpo); return 0; } + +result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records) +{ + /* Construct Objects table in db.dat */ + dat_construct(db->dat, db->dic, records, num_records); + + /* Construct Music table in db.dat */ + + /* Construct db.idx */ + + /* Update db.dic */ + + return 0; +} + +void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record) +{ + int i; + ip3db_variant_t* var = (ip3db_variant_t*)record; + for (i = 0;i < IP3DBF_MUSIC_LAST;++i) { + ip3db_variant_init(&var[i], db->dic->music.fields[i].type); + } +} Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-25 14:33:57 UTC (rev 200) @@ -84,6 +84,14 @@ IP3DBF_MUSIC_LAST, }; +typedef ip3db_variant_t ip3db_music_record_t[IP3DBF_MUSIC_LAST]; + +typedef struct { + const ip3db_music_record_t* base; + int index; +} ip3db_sort_index_t; + + enum { IP3DBF_OBJECTS_NONE = -1, IP3DBF_OBJECTS_BEGIN = 0, @@ -149,14 +157,23 @@ dat_t* dat; dic_t* dic; + } ip3db_t; void ip3db_variant_init(ip3db_variant_t* var, int type); void ip3db_variant_finish(ip3db_variant_t* var); +void ip3db_variant_set_byte(ip3db_variant_t* var, uint8_t val); +void ip3db_variant_set_word(ip3db_variant_t* var, uint16_t val); +void ip3db_variant_set_dword(ip3db_variant_t* var, uint32_t val); +void ip3db_variant_set_str(ip3db_variant_t* var, const ucs2char_t* val); +void ip3db_variant_clone(ip3db_variant_t* dst, const ip3db_variant_t* src); void ip3db_init(ip3db_t* db); void ip3db_finish(ip3db_t* db); result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); result_t ip3db_dump(ip3db_t* db, FILE *fpo); +void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record); +result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records); + #endif /*_IP3DB_IP3DB_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-25 07:46:57 UTC (rev 199) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-25 14:33:57 UTC (rev 200) @@ -65,7 +65,7 @@ "iriver_e10_ums_1.04", "E10 UMS", "UM", "1.04", "1.04", "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", - "\\", "Playlists\\", + "", "Playlists\\", ".plp", }, { @@ -503,9 +503,30 @@ static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { + int i; pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; - return PMP_NOTIMPLIMENTED; + ucs2char_t *path_to_root = alloca(sizeof(ucs2char_t) * (ucs2len(pmpi->env.path_to_root)+1)); + + ip3db_music_record_t* array = (ip3db_music_record_t*)malloc(sizeof(ip3db_music_record_t) * num_records); + + ucs2cpy(path_to_root, pmpi->env.path_to_root); + filepath_removeslash(path_to_root); + + for (i = 0;i < num_records;++i) { + const pmp_record_t* src = &records[i]; + ip3db_variant_t* dst = array[i]; + + ip3db_record_init(&pmpdbi->ip3db, &array[i]); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], src->filename + ucs2len(path_to_root)); + filepath_remove_filespec(dst[IP3DBF_MUSIC_FILEPATH].value.str); + filepath_addslash(dst[IP3DBF_MUSIC_FILEPATH].value.str); + filepath_encode(dst[IP3DBF_MUSIC_FILEPATH].value.str); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILENAME], filepath_skippath(src->filename)); + } + ip3db_set(&pmpdbi->ip3db, array, num_records); + free(array); + return 0; //return ip2db_set(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-25 07:46:59
|
Revision: 199 http://svn.sourceforge.net/pmplib/?rev=199&view=rev Author: nyaochi Date: 2006-12-24 23:46:57 -0800 (Sun, 24 Dec 2006) Log Message: ----------- Improve idx.c to use dic.c Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/idx.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-25 07:46:57 UTC (rev 199) @@ -46,7 +46,7 @@ #include "dic.h" #include "dat.h" -static void dat_entry_init(dat_entry_t* entry, const dic_list_t* dic_list) +static void dat_entry_init(dat_entry_t* entry, const dic_table_t* dic_list) { memset(entry, 0, sizeof(*entry)); entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * dic_list->num_fields); @@ -103,14 +103,18 @@ return (size_t)(p - block); } -static void dat_entry_dump(dat_entry_t* entry, const dic_list_t* dic_list, FILE *fp) +static void dat_entry_dump(dat_entry_t* entry, const dic_table_t* dic_list, FILE *fp) { int i; + /* Loop for all fields in this entry. */ for (i = 0;i < entry->num_fields;++i) { ip3db_variant_t* var = &entry->fields[i]; + /* Output the field name. */ fprints(fp, " %s: ", dic_list->fields[i].name); + + /* Output its value. */ switch (var->type) { case IP3DBVT_STRING: fprints(fp, "%s\n", var->value.str); @@ -128,6 +132,8 @@ } } + + static void dat_list_init(dat_list_t* list) { memset(list, 0, sizeof(*list)); @@ -143,7 +149,7 @@ dat_list_init(list); } -static size_t dat_list_serialize(dat_list_t* list, const dic_list_t* dic_list, uint8_t* buffer, int is_storing) +static size_t dat_list_serialize(dat_list_t* list, const dic_table_t* dic_list, uint8_t* buffer, int is_storing) { uint32_t i; uint8_t *p = buffer; @@ -171,7 +177,7 @@ return (size_t)(p - buffer); } -static void dat_list_dump(dat_list_t* list, const dic_list_t* dic_list, FILE *fp) +static void dat_list_dump(dat_list_t* list, const dic_table_t* dic_list, FILE *fp) { uint32_t i; @@ -188,6 +194,8 @@ } } + + dat_t* dat_new() { dat_t* dat = (dat_t*)malloc(sizeof(dat_t)); Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-25 07:46:57 UTC (rev 199) @@ -42,60 +42,104 @@ #include "ip3db.h" #include "dic.h" -static void dic_entry_init(dic_entry_t* entry) +static dic_index_t music_indices[] = { + {0, 0x0086, {IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x00F8, {IP3DBF_MUSIC_RATING, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x0152, {IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x022C, {IP3DBF_MUSIC_CHANGEDFLAG, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x027A, {IP3DBF_MUSIC_CLUSM, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x031C, {IP3DBF_MUSIC_UID, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x0352, {IP3DBF_MUSIC_GENRE, IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TITLE}}, + {0, 0x0384, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_ALBUM, IP3DBF_MUSIC_TRACKNUMBER}}, + {0, 0x03C2, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE}}, + {0, 0x03F4, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE}}, + {0, 0x041A, {IP3DBF_MUSIC_GENRE, IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE}}, + {0, 0x043E, {IP3DBF_MUSIC_ALBUM, IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE}}, +}; + +static dic_index_t objects_indices[] = { + {0, 0x099A, {IP3DBF_OBJECTS_UID, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x09F0, {IP3DBF_OBJECTS_FILETYPE, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x0A0E, {IP3DBF_OBJECTS_OBJECTNAME, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, + {0, 0x0ACE, {IP3DBF_OBJECTS_FILETYPE, IP3DBF_OBJECTS_PARENTUID, IP3DBF_OBJECTS_PROPERTIES}}, +}; + +static void dic_field_init(dic_field_t* entry) { memset(entry, 0, sizeof(*entry)); } -static void dic_entry_finish(dic_entry_t* entry) +static void dic_field_finish(dic_field_t* entry) { ucs2free(entry->name); - dic_entry_init(entry); + dic_field_init(entry); } -static void dic_entry_dump(const dic_entry_t* entry, FILE *fp) +static size_t dic_field_serialize(uint8_t* block, dic_field_t* entry, int is_storing) { + uint8_t *p = block; + p += serialize_uint32be(p, &entry->next, 0); + p += serialize_uint32be(p, &entry->type, 0); + p += serialize_uint32be(p, &entry->idx_root, 0); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); + } + return (size_t)(p - block); +} + +static void dic_field_dump(const dic_field_t* entry, FILE *fp) +{ fprintf(fp, " next: 0x%08X\n", entry->next); fprintf(fp, " type: 0x%08X\n", entry->type); fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); fprints(fp, " name: %s\n", entry->name); } -static void dic_list_init(dic_list_t* list) + + +static void dic_table_init(dic_table_t* list) { memset(list, 0, sizeof(*list)); } -static void dic_list_finish(dic_list_t* list) +static void dic_table_finish(dic_table_t* list) { int i; for (i = 0;i < list->num_fields;++i) { - dic_entry_finish(&list->fields[i]); + dic_field_finish(&list->fields[i]); } free(list->fields); } -static void dic_list_dump(dic_list_t* list, FILE *fp) +static void dic_table_dump(dic_table_t* list, FILE *fp) { int i; for (i = 0;i < list->num_fields;++i) { - const dic_entry_t* entry = &list->fields[i]; + const dic_field_t* entry = &list->fields[i]; fprintf(fp, " FIELD %d = {\n", i); - dic_entry_dump(entry, fp); + dic_field_dump(entry, fp); fprintf(fp, " }\n"); } } + + dic_t* dic_new() { dic_t* dic = (dic_t*)malloc(sizeof(dic_t)); if (dic) { - dic_list_init(&dic->music); + dic_table_init(&dic->music); dic->music.num_fields = IP3DBF_MUSIC_LAST; - dic->music.fields = (dic_entry_t*)calloc(dic->music.num_fields, sizeof(dic_entry_t)); - dic_list_init(&dic->objects); + dic->music.fields = (dic_field_t*)calloc(dic->music.num_fields, sizeof(dic_field_t)); + dic->music.num_indices = sizeof(music_indices) / sizeof(music_indices[0]); + dic->music.indices = music_indices; + dic_table_init(&dic->objects); dic->objects.num_fields = IP3DBF_OBJECTS_LAST; - dic->objects.fields = (dic_entry_t*)calloc(dic->objects.num_fields, sizeof(dic_entry_t)); + dic->objects.fields = (dic_field_t*)calloc(dic->objects.num_fields, sizeof(dic_field_t)); + dic->objects.num_indices = sizeof(objects_indices) / sizeof(objects_indices[0]); + dic->objects.indices = objects_indices; } return dic; } @@ -103,26 +147,12 @@ void dic_finish(dic_t* dic) { if (dic) { - dic_list_finish(&dic->music); - dic_list_finish(&dic->objects); + dic_table_finish(&dic->music); + dic_table_finish(&dic->objects); free(dic); } } -static size_t dic_serialize_entry(uint8_t* block, dic_entry_t* entry, int is_storing) -{ - uint8_t *p = block; - p += serialize_uint32be(p, &entry->next, 0); - p += serialize_uint32be(p, &entry->type, 0); - p += serialize_uint32be(p, &entry->idx_root, 0); - if (is_storing) { - p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); - } else { - p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); - } - return (size_t)(p - block); -} - int dic_serialize(dic_t* dic, uint8_t* buffer, int is_storing) { int i; @@ -130,16 +160,26 @@ next = 0x0000003C; for (i = 0;i < dic->music.num_fields;++i) { - dic_serialize_entry(buffer + next, &dic->music.fields[i], is_storing); + dic_field_serialize(buffer + next, &dic->music.fields[i], is_storing); next = dic->music.fields[i].next; } next = 0x0000099A; for (i = 0;i < dic->objects.num_fields;++i) { - dic_serialize_entry(buffer + next, &dic->objects.fields[i], is_storing); + dic_field_serialize(buffer + next, &dic->objects.fields[i], is_storing); next = dic->objects.fields[i].next; } + for (i = 0;i < dic->music.num_indices;++i) { + uint32_t offset = dic->music.indices[i].offset + sizeof(uint32_t) * 2; + serialize_uint32be(buffer + offset, &dic->music.indices[i].idx_root, is_storing); + } + + for (i = 0;i < dic->objects.num_indices;++i) { + uint32_t offset = dic->objects.indices[i].offset + sizeof(uint32_t) * 2; + serialize_uint32be(buffer + offset, &dic->objects.indices[i].idx_root, is_storing); + } + return 0; } @@ -147,17 +187,54 @@ { fprintf(fp, "===== db.dic =====\n"); fprintf(fp, "MUSIC {\n"); - dic_list_dump(&dic->music, fp); + dic_table_dump(&dic->music, fp); fprintf(fp, "OBJECTS {\n"); - dic_list_dump(&dic->objects, fp); + dic_table_dump(&dic->objects, fp); fprintf(fp, "\n"); } -uint32_t dic_get_idxroot(uint8_t *buffer, int field) +uint32_t dic_get_idxroot(dic_t* dic, int table, int index) { - uint32_t value; - ip3db_index_param_t* index_param = ip3db_get_indexparam(field); - uint8_t *p = buffer + index_param->dic_offset; - serialize_uint32be(p + sizeof(uint32_t) * 2, &value, 0); - return value; + const dic_index_t* indices = NULL; + switch (table) { + case IP3DBIDX_MUSIC: + indices = dic->music.indices; + break; + case IP3DBIDX_OBJECTS: + indices = dic->objects.indices; + break; + } + if (indices) { + return indices[index].idx_root; + } else { + return 0; + } } + +void dic_repr_index(dic_t* dic, int table, int index, FILE *fp) +{ + int i; + const dic_table_t* tbl = NULL; + const dic_index_t* idx = NULL; + + switch (table) { + case IP3DBIDX_MUSIC: + tbl = &dic->music; + break; + case IP3DBIDX_OBJECTS: + tbl = &dic->objects; + break; + } + + idx = &tbl->indices[index]; + for (i = 0;i < IP3DBIDX_MAX_KEYLEVEL;++i) { + int field = idx->fields[i]; + if (field == IP3DBF_MUSIC_NONE) { + break; + } + if (i != 0) { + fputc('-', fp); + } + fprints(fp, "%s", tbl->fields[field].name); + } +} Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-25 07:46:57 UTC (rev 199) @@ -29,16 +29,24 @@ uint32_t type; uint32_t idx_root; ucs2char_t* name; -} dic_entry_t; +} dic_field_t; typedef struct { + uint32_t idx_root; + uint32_t offset; + int fields[IP3DBIDX_MAX_KEYLEVEL]; +} dic_index_t; + +typedef struct { int num_fields; - dic_entry_t *fields; -} dic_list_t; + dic_field_t *fields; + int num_indices; + dic_index_t *indices; +} dic_table_t; struct tag_dic_t { - dic_list_t music; - dic_list_t objects; + dic_table_t music; + dic_table_t objects; }; typedef struct tag_dic_t dic_t; @@ -46,7 +54,7 @@ void dic_finish(dic_t* dic); int dic_serialize(dic_t* dic, uint8_t* buffer, int is_storing); void dic_dump(dic_t* dic, FILE *fp); +uint32_t dic_get_idxroot(dic_t* dic, int table, int index); +void dic_repr_index(dic_t* dic, int table, int index, FILE *fp); -uint32_t dic_get_idxroot(uint8_t *buffer, int field); - #endif/*__IP3DB_DIC_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-25 07:46:57 UTC (rev 199) @@ -104,7 +104,8 @@ uint32_t offset, node_t* node, ip3db_variant_t* key, - int* types, + dic_table_t* dic_table, + int index, int level, int flag, void *instance @@ -113,7 +114,8 @@ void idx_walk( uint8_t *buffer, uint32_t offset, - int *types, + dic_table_t* dic_table, + int index, int level, idx_walk_callback_t callback, void *instance @@ -121,7 +123,8 @@ { node_t node; ip3db_variant_t key; - int type = types[level]; + int field = dic_table->indices[index].fields[level]; + int type = dic_table->fields[field].type; uint8_t* p = buffer + offset; /* Read the node information. */ @@ -129,7 +132,7 @@ /* Descend to left children. */ if (node.left) { - idx_walk(buffer, node.left, types, level, callback, instance); + idx_walk(buffer, node.left, dic_table, index, level, callback, instance); } /* Read the key value. */ @@ -151,22 +154,25 @@ /* Invoke the callback function. */ if (callback && type) { - callback(buffer, offset, &node, &key, types, level, 1, instance); + callback(buffer, offset, &node, &key, dic_table, index, level, 1, instance); } /* Descend to the next key level if necessary. */ - if (level+1 < IP3DBIDX_MAX_KEYLEVEL && types[level+1]) { - idx_walk(buffer, node.leaf, types, level+1, callback, instance); + if (level+1 < IP3DBIDX_MAX_KEYLEVEL) { + int next_field = dic_table->indices[index].fields[level+1]; + if (next_field != -1) { + idx_walk(buffer, node.leaf, dic_table, index, level+1, callback, instance); + } } /* Invoke the callback function. */ if (callback && type) { - callback(buffer, offset, &node, &key, types, level, 0, instance); + callback(buffer, offset, &node, &key, dic_table, index, level, 0, instance); } /* Descend to right children. */ if (node.right) { - idx_walk(buffer, node.right, types, level, callback, instance); + idx_walk(buffer, node.right, dic_table, index, level, callback, instance); } } @@ -180,13 +186,17 @@ uint32_t offset, node_t* node, ip3db_variant_t* key, - int* types, + dic_table_t* dic_table, + int index, int level, int flag, void *instance ) { FILE *fp = (FILE*)instance; + int field = dic_table->indices[index].fields[level]; + int type = dic_table->fields[field].type; + int is_tail = (IP3DBIDX_MAX_KEYLEVEL <= level+1 || dic_table->indices[index].fields[level+1] == -1); int indent = 2 * (level + 1); if (flag) { @@ -217,14 +227,14 @@ } fprintf(fp, "\n"); - if (IP3DBIDX_MAX_KEYLEVEL <= level+1 || !types[level+1]) { + if (is_tail) { tail_t tail; memset(&tail, 0, sizeof(tail)); tail.next = node->leaf; fprinti(fp, indent); - fprintf(fp, " dat_offset: [\n", node->left); + fprintf(fp, " TAIL: [\n", node->left); while (tail.next) { uint8_t *p = buffer + tail.next; idx_serialize_tail(p, &tail, 0); @@ -242,7 +252,7 @@ return 0; } -int idx_dump(FILE *fpo, ip3db_t* db) +int idx_dump(uint8_t* buffer, dic_t* dic, FILE *fpo) { int i; header_t header; @@ -250,18 +260,26 @@ fprintf(fpo, "===== db.idx =====\n"); /* Dump the header. */ - idx_serialize_header(db->idx_buffer, &header, 0); + idx_serialize_header(buffer, &header, 0); fprintf(fpo, "size: 0x%08X\n", header.size); fprintf(fpo, "unknown1: 0x%08X\n", header.unknown1); fprintf(fpo, "unknown2: 0x%08X\n", header.unknown2); /* Dump the binary search trees. */ - for (i = 0;i < IP3DBIDX_LAST;++i) { - ip3db_index_param_t* index_param = ip3db_get_indexparam(i); - uint32_t idx_root = dic_get_idxroot(db->dic_buffer, i); - fprintf(fpo, "[%s]\n", index_param->name); - idx_walk(db->idx_buffer, idx_root, index_param->types, 0, idx_walkcb_dump, (void*)stdout); + for (i = 0;i < dic->music.num_indices;++i) { + uint32_t idx_root = dic_get_idxroot(dic, IP3DBIDX_MUSIC, i); + fprintf(fpo, "["); + dic_repr_index(dic, IP3DBIDX_MUSIC, i, fpo); + fprintf(fpo, "]\n"); + idx_walk(buffer, idx_root, &dic->music, i, 0, idx_walkcb_dump, (void*)stdout); } + for (i = 0;i < dic->objects.num_indices;++i) { + uint32_t idx_root = dic_get_idxroot(dic, IP3DBIDX_OBJECTS, i); + fprintf(fpo, "["); + dic_repr_index(dic, IP3DBIDX_OBJECTS, i, fpo); + fprintf(fpo, "]\n"); + idx_walk(buffer, idx_root, &dic->objects, i, 0, idx_walkcb_dump, (void*)stdout); + } fprintf(fpo, "\n"); return 0; Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-25 07:46:57 UTC (rev 199) @@ -19,10 +19,11 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __IP3DB_IDX_H__ #define __IP3DB_IDX_H__ +int idx_dump(uint8_t* buffer, dic_t* dic, FILE *fpo); #endif/*__IP3DB_IDX_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-25 07:46:57 UTC (rev 199) @@ -34,26 +34,8 @@ #include "ip3db.h" #include "dic.h" #include "dat.h" +#include "idx.h" -static ip3db_index_param_t ip3db_index_param[IP3DBIDX_LAST] = { - {"Music.Title", 0x0086, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.Rating", 0x00F8, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.TrackNumber", 0x0152, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.ChangedFlag", 0x022C, {IP3DBVT_BYTE, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.ClusM", 0x027A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.UID", 0x031C, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Music.Genre-Artist-Title", 0x0352, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_STRING}}, - {"Music.Artist-Album-TrackNumber", 0x0384, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_WORD}}, - {"Music.Artist-TrackNumber", 0x03C2, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, - {"Music.Artist-Title", 0x03F4, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, - {"Music.Genre-Title", 0x041A, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, - {"Music.Album-TrackNumber", 0x043E, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, - {"Object.UID", 0x099A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Object.FileType", 0x09F0, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Object.ObjectName", 0x0A0E, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, - {"Object.FileType-ParentUid-Properties", 0x0ACE, {IP3DBVT_WORD, IP3DBVT_DWORD, IP3DBVT_BYTE}}, -}; - void ip3db_variant_init(ip3db_variant_t* var, int type) { memset(var, 0, sizeof(*var)); @@ -68,11 +50,6 @@ ip3db_variant_init(var, IP3DBVT_NONE); } -ip3db_index_param_t* ip3db_get_indexparam(int field) -{ - return &ip3db_index_param[field]; -} - void ip3db_init(ip3db_t* db) { memset(db, 0, sizeof(*db)); @@ -140,6 +117,6 @@ dat_dump(db->dat, db->dic, fpo); /* Dump db.idx */ - idx_dump(fpo, db); + idx_dump(db->idx_buffer, db->dic, fpo); return 0; } Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 18:21:20 UTC (rev 198) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-25 07:46:57 UTC (rev 199) @@ -25,26 +25,6 @@ #define __IP3DB_IP3DB_H__ enum { - IP3DBIDX_MUSIC_TITLE, - IP3DBIDX_MUSIC_RATING, - IP3DBIDX_MUSIC_TRACKNUMBER, - IP3DBIDX_MUSIC_CHANGEDFLAG, - IP3DBIDX_MUSIC_CLUSM, - IP3DBIDX_MUSIC_UID, - IP3DBIDX_MUSIC_GENRE_ARTIST_TITLE, - IP3DBIDX_MUSIC_ARTIST_ALBUM_TRACKNUMBER, - IP3DBIDX_MUSIC_ARTIST_TRACKNUMBER, - IP3DBIDX_MUSIC_ARTIST_TITLE, - IP3DBIDX_MUSIC_GENRE_TITLE, - IP3DBIDX_MUSIC_ALBUM_TRACKNUMBER, - IP3DBIDX_OBJECT_UID, - IP3DBIDX_OBJECT_FILETYPE, - IP3DBIDX_OBJECT_OBJECTNAME, - IP3DBIDX_OBJECT_FILETYPE_PARENTUID_PROP, - IP3DBIDX_LAST -}; - -enum { IP3DBIDX_MAX_KEYLEVEL = 3, }; @@ -73,6 +53,7 @@ } ip3db_variant_t; enum { + IP3DBF_MUSIC_NONE = -1, IP3DBF_MUSIC_BEGIN = 0, IP3DBF_MUSIC_ARTIST = 0, IP3DBF_MUSIC_ALBUM, @@ -104,6 +85,7 @@ }; enum { + IP3DBF_OBJECTS_NONE = -1, IP3DBF_OBJECTS_BEGIN = 0, IP3DBF_OBJECTS_UID = 0, IP3DBF_OBJECTS_PARENTUID, @@ -119,15 +101,41 @@ IP3DBF_OBJECTS_LAST, }; +enum { + IP3DBIDX_MUSIC = 0, + IP3DBIDX_OBJECTS, +}; +enum { + IP3DBIDX_MUSIC_NONE = -1, + IP3DBIDX_MUSIC_BEGIN = 0, + IP3DBIDX_MUSIC_TITLE = 0, + IP3DBIDX_MUSIC_RATING, + IP3DBIDX_MUSIC_TRACKNUMBER, + IP3DBIDX_MUSIC_CHANGEDFLAG, + IP3DBIDX_MUSIC_CLUSM, + IP3DBIDX_MUSIC_UID, + IP3DBIDX_MUSIC_GENRE_ARTIST_TITLE, + IP3DBIDX_MUSIC_ARTIST_ALBUM_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TITLE, + IP3DBIDX_MUSIC_GENRE_TITLE, + IP3DBIDX_MUSIC_ALBUM_TRACKNUMBER, + IP3DBIDX_MUSIC_LAST, +}; +enum { + IP3DBIDX_OBJECT_NONE = -1, + IP3DBIDX_OBJECT_BEGIN = 0, + IP3DBIDX_OBJECT_UID, + IP3DBIDX_OBJECT_FILETYPE, + IP3DBIDX_OBJECT_OBJECTNAME, + IP3DBIDX_OBJECT_FILETYPE_PARENTUID_PROP, + IP3DBIDX_OBJECT_LAST, +}; -typedef struct { - const char* name; - uint32_t dic_offset; - int types[IP3DBIDX_MAX_KEYLEVEL]; -} ip3db_index_param_t; + struct tag_dat_t; typedef struct tag_dat_t dat_t; struct tag_dic_t; typedef struct tag_dic_t dic_t; @@ -143,10 +151,6 @@ dic_t* dic; } ip3db_t; -int idx_dump(FILE *fpo, ip3db_t* db); - -ip3db_index_param_t* ip3db_get_indexparam(int field); - void ip3db_variant_init(ip3db_variant_t* var, int type); void ip3db_variant_finish(ip3db_variant_t* var); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 18:21:20
|
Revision: 198 http://svn.sourceforge.net/pmplib/?rev=198&view=rev Author: nyaochi Date: 2006-12-24 10:21:20 -0800 (Sun, 24 Dec 2006) Log Message: ----------- Trivial source code clean-up. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 18:03:21 UTC (rev 197) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 18:21:20 UTC (rev 198) @@ -27,7 +27,7 @@ - 0x00020000-0x0003FFFF: music (media information) chunk - Each chunk has a 16-bytes header at the beginning - Each chunk has an array of offsets to actual entries at the end (backward) -- Field names in db.dat seem to be defined in db.dic (Music and Objects) +- Field names in db.dat are defined in db.dic (Music and Objects) */ #ifdef HAVE_CONFIG_H @@ -48,12 +48,14 @@ static void dat_entry_init(dat_entry_t* entry, const dic_list_t* dic_list) { - int i; memset(entry, 0, sizeof(*entry)); - entry->num_fields = dic_list->num_fields; - entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * entry->num_fields); - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_init(&entry->fields[i], dic_list->fields[i].type); + entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * dic_list->num_fields); + if (entry->fields) { + int i; + entry->num_fields = dic_list->num_fields; + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_init(&entry->fields[i], dic_list->fields[i].type); + } } } @@ -67,13 +69,15 @@ memset(entry, 0, sizeof(*entry)); } -static size_t dat_entry_serialize(uint8_t* block, uint8_t* q, dat_entry_t* entry, int is_storing) +static size_t dat_entry_serialize(dat_entry_t* entry, uint8_t* block, uint8_t* q, int is_storing) { int i; uint8_t *p = block; + /* Serialize offset address of this entry. */ q -= serialize_uint32be(q, &entry->offset, is_storing); + /* Serialize all fields in this entry. */ for (i = 0;i < entry->num_fields;++i) { ip3db_variant_t* var = &entry->fields[i]; switch (var->type) { @@ -99,7 +103,7 @@ return (size_t)(p - block); } -static void dat_entry_dump(dat_entry_t* entry, FILE *fp, const dic_list_t* dic_list) +static void dat_entry_dump(dat_entry_t* entry, const dic_list_t* dic_list, FILE *fp) { int i; @@ -139,7 +143,7 @@ dat_list_init(list); } -static size_t dat_list_serialize(uint8_t* buffer, dat_list_t* list, int is_storing, const dic_list_t* dic_list) +static size_t dat_list_serialize(dat_list_t* list, const dic_list_t* dic_list, uint8_t* buffer, int is_storing) { uint32_t i; uint8_t *p = buffer; @@ -160,14 +164,14 @@ for (i = 0;i < list->num_entries;++i) { dat_entry_t* entry = &list->entries[i]; - p += dat_entry_serialize(p, q, entry, is_storing); + p += dat_entry_serialize(entry, p, q, is_storing); q -= sizeof(uint32_t); } return (size_t)(p - buffer); } -static void dat_list_dump(dat_list_t* list, FILE *fp, const dic_list_t* dic_list) +static void dat_list_dump(dat_list_t* list, const dic_list_t* dic_list, FILE *fp) { uint32_t i; @@ -179,7 +183,7 @@ for (i = 0;i < list->num_entries;++i) { dat_entry_t* entry = &list->entries[i]; fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, entry->offset); - dat_entry_dump(entry, fp, dic_list); + dat_entry_dump(entry, dic_list, fp); fprintf(fp, " }\n"); } } @@ -203,8 +207,8 @@ size_t dat_serialize(dat_t* dat, const dic_t* dic, uint8_t* buffer, int is_storing) { - dat_list_serialize(buffer, &dat->objects, is_storing, &dic->objects); - dat_list_serialize(buffer + 0x00020000, &dat->musics, is_storing, &dic->music); + dat_list_serialize(&dat->objects, &dic->objects, buffer, is_storing); + dat_list_serialize(&dat->musics, &dic->music, buffer + 0x00020000, is_storing); return 0; } @@ -212,9 +216,9 @@ { fprintf(fp, "===== db.dat =====\n"); fprintf(fp, "OBJECTS = {\n"); - dat_list_dump(&dat->objects, fp, &dic->objects); + dat_list_dump(&dat->objects, &dic->objects, fp); fprintf(fp, "}\n"); fprintf(fp, "MUSIC = {\n"); - dat_list_dump(&dat->musics, fp, &dic->music); + dat_list_dump(&dat->musics, &dic->music, fp); fprintf(fp, "}\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 18:03:21
|
Revision: 197 http://svn.sourceforge.net/pmplib/?rev=197&view=rev Author: nyaochi Date: 2006-12-24 10:03:21 -0800 (Sun, 24 Dec 2006) Log Message: ----------- Generalized fields in db.dat by using field type definitions in db.dic Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 18:03:21 UTC (rev 197) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ /* Brief summary of db.dat structure: @@ -42,277 +42,179 @@ #include "serialize.h" #include "util.h" +#include "ip3db.h" +#include "dic.h" #include "dat.h" -static void dat_object_finish(dat_object_t* entry) +static void dat_entry_init(dat_entry_t* entry, const dic_list_t* dic_list) { - ucs2free(entry->object_name); - ucs2free(entry->name); + int i; + memset(entry, 0, sizeof(*entry)); + entry->num_fields = dic_list->num_fields; + entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * entry->num_fields); + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_init(&entry->fields[i], dic_list->fields[i].type); + } } -static void dat_objects_init(dat_objects_t* objects) +static void dat_entry_finish(dat_entry_t* entry) { - memset(objects, 0, sizeof(dat_objects_t)); -} - -static void dat_objects_finish(dat_objects_t* objects) -{ - uint32_t i; - for (i = 0;i < objects->num_entries;++i) { - dat_object_finish(&objects->entries[i]); + int i; + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_finish(&entry->fields[i]); } - free(objects->entries); - free(objects->offsets); - dat_objects_init(objects); + free(entry->fields); + memset(entry, 0, sizeof(*entry)); } -static size_t dat_objects_serialize(uint8_t* buffer, dat_objects_t* objects, int is_storing) +static size_t dat_entry_serialize(uint8_t* block, uint8_t* q, dat_entry_t* entry, int is_storing) { - uint32_t i; - uint8_t *p = buffer; - uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); + int i; + uint8_t *p = block; - p += serialize_uint32be(p, &objects->size, is_storing); - p += serialize_uint32be(p, &objects->num_entries, is_storing); - p += serialize_uint32be(p, &objects->unknown1, is_storing); - p += serialize_uint32be(p, &objects->unknown2, is_storing); + q -= serialize_uint32be(q, &entry->offset, is_storing); - if (!is_storing) { - free(objects->entries); - free(objects->offsets); - objects->entries = (dat_object_t*)calloc(objects->num_entries, sizeof(dat_object_t)); - objects->offsets = (uint32_t*)calloc(objects->num_entries, sizeof(uint32_t)); - } - - for (i = 0;i < objects->num_entries;++i) { - dat_object_t* entry = &objects->entries[i]; - - /* Read an element in the offset table. */ - q -= serialize_uint32be(q, &objects->offsets[i], is_storing); - - /* Read an entry. */ - p += serialize_uint32be(p, &entry->uid, is_storing); - p += serialize_uint32be(p, &entry->parent_uid, is_storing); - p += serialize_uint8(p, &entry->properties, is_storing); - p += serialize_uint16be(p, &entry->filetype, is_storing); - if (is_storing) { - p += (serialize_ucs2be_string_var(p, entry->object_name, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); - } else { - p += (serialize_ucs2be_string_var_alloc(p, &entry->object_name) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_t* var = &entry->fields[i]; + switch (var->type) { + case IP3DBVT_STRING: + if (is_storing) { + p += (serialize_ucs2be_string_var(p, var->value.str, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &var->value.str) + 1) * sizeof(ucs2char_t); + } + break; + case IP3DBVT_BYTE: + p += serialize_uint8(p, &var->value.byte, is_storing); + break; + case IP3DBVT_WORD: + p += serialize_uint16be(p, &var->value.word, is_storing); + break; + case IP3DBVT_DWORD: + p += serialize_uint32be(p, &var->value.dword, is_storing); + break; } - p += serialize_uint32be(p, &entry->filesize, is_storing); - p += serialize_uint32be(p, &entry->datecrea, is_storing); - p += serialize_uint32be(p, &entry->rawid, is_storing); - p += serialize_uint32be(p, &entry->puoid1, is_storing); - p += serialize_uint32be(p, &entry->puoid2, is_storing); } - return (size_t)(p - buffer); + return (size_t)(p - block); } -static void dat_objects_dump(FILE *fp, dat_objects_t* objects) +static void dat_entry_dump(dat_entry_t* entry, FILE *fp, const dic_list_t* dic_list) { - uint32_t i; + int i; - fprintf(fp, "OBJECTS {\n"); - fprintf(fp, " size: 0x%08X\n", objects->size); - fprintf(fp, " num_entries: %d\n", objects->num_entries); - fprintf(fp, " unknown1: 0x%08X\n", objects->unknown1); - fprintf(fp, " unknown2: 0x%08X\n", objects->unknown2); + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_t* var = &entry->fields[i]; - for (i = 0;i < objects->num_entries;++i) { - dat_object_t* entry = &objects->entries[i]; - fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, objects->offsets[i]); - fprintf(fp, " uid: %d\n", entry->uid); - fprintf(fp, " parent_uid: %d\n", entry->parent_uid); - fprintf(fp, " properties: 0x%02X\n", entry->properties); - fprintf(fp, " filetype: 0x%04X\n", entry->filetype); - fprints(fp, " object_name: %s\n", entry->object_name); - fprints(fp, " name: %s\n", entry->name); - fprintf(fp, " filesize: %d\n", entry->filesize); - fprintf(fp, " datecrea: %d\n", entry->datecrea); - fprintf(fp, " rawid: %d\n", entry->rawid); - fprintf(fp, " puoid1: %d\n", entry->puoid1); - fprintf(fp, " puoid2: %d\n", entry->puoid2); - fprintf(fp, " }\n"); + fprints(fp, " %s: ", dic_list->fields[i].name); + switch (var->type) { + case IP3DBVT_STRING: + fprints(fp, "%s\n", var->value.str); + break; + case IP3DBVT_BYTE: + fprintf(fp, "0x%02X\n", var->value.byte); + break; + case IP3DBVT_WORD: + fprintf(fp, "%d\n", var->value.word); + break; + case IP3DBVT_DWORD: + fprintf(fp, "%d\n", var->value.dword); + break; + } } - fprintf(fp, "}\n"); } - - -static void dat_music_finish(dat_music_t* entry) +static void dat_list_init(dat_list_t* list) { - ucs2free(entry->artist); - ucs2free(entry->album); - ucs2free(entry->genre); - ucs2free(entry->title); - ucs2free(entry->filepath); - ucs2free(entry->filename); - ucs2free(entry->release); - ucs2free(entry->album_artist); + memset(list, 0, sizeof(*list)); } -static void dat_musics_init(dat_musics_t* musics) +static void dat_list_finish(dat_list_t* list) { - memset(musics, 0, sizeof(dat_musics_t)); -} - -static void dat_musics_finish(dat_musics_t* musics) -{ uint32_t i; - for (i = 0;i < musics->num_entries;++i) { - dat_music_finish(&musics->entries[i]); + for (i = 0;i < list->num_entries;++i) { + dat_entry_finish(&list->entries[i]); } - free(musics->entries); - free(musics->offsets); - dat_musics_init(musics); + free(list->entries); + dat_list_init(list); } -static size_t dat_musics_serialize(uint8_t* buffer, dat_musics_t* musics, int is_storing) +static size_t dat_list_serialize(uint8_t* buffer, dat_list_t* list, int is_storing, const dic_list_t* dic_list) { uint32_t i; uint8_t *p = buffer; uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); - p += serialize_uint32be(p, &musics->size, is_storing); - p += serialize_uint32be(p, &musics->num_entries, is_storing); - p += serialize_uint32be(p, &musics->unknown1, is_storing); - p += serialize_uint32be(p, &musics->unknown2, is_storing); + p += serialize_uint32be(p, &list->size, is_storing); + p += serialize_uint32be(p, &list->num_entries, is_storing); + p += serialize_uint32be(p, &list->unknown1, is_storing); + p += serialize_uint32be(p, &list->unknown2, is_storing); if (!is_storing) { - free(musics->entries); - free(musics->offsets); - musics->entries = (dat_music_t*)calloc(musics->num_entries, sizeof(dat_music_t)); - musics->offsets = (uint32_t*)calloc(musics->num_entries, sizeof(uint32_t)); + free(list->entries); + list->entries = (dat_entry_t*)calloc(list->num_entries, sizeof(dat_entry_t)); + for (i = 0;i < list->num_entries;++i) { + dat_entry_init(&list->entries[i], dic_list); + } } - for (i = 0;i < musics->num_entries;++i) { - dat_music_t* entry = &musics->entries[i]; - - /* Read an element in the offset table. */ - q -= serialize_uint32be(q, &musics->offsets[i], is_storing); - - /* Read an entry. */ - if (is_storing) { - p += (serialize_ucs2be_string_var(p, entry->artist, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->album, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->genre, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->title, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->filepath, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->filename, is_storing) + 1) * sizeof(ucs2char_t); - } else { - p += (serialize_ucs2be_string_var_alloc(p, &entry->artist) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->album) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->genre) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->title) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->filepath) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->filename) + 1) * sizeof(ucs2char_t); - } - p += serialize_uint32be(p, &entry->duration, is_storing); - p += serialize_uint16be(p, &entry->rating, is_storing); - p += serialize_uint32be(p, &entry->use_count, is_storing); - p += serialize_uint16be(p, &entry->format, is_storing); - p += serialize_uint16be(p, &entry->tracknumber, is_storing); - p += serialize_uint8(p, &entry->drm, is_storing); - p += serialize_uint8(p, &entry->lyric, is_storing); - p += serialize_uint8(p, &entry->purchase, is_storing); - p += serialize_uint16be(p, &entry->protection, is_storing); - p += serialize_uint32be(p, &entry->samplerate, is_storing); - p += serialize_uint32be(p, &entry->bitrate, is_storing); - p += serialize_uint8(p, &entry->changed_flag, is_storing); - p += serialize_uint32be(p, &entry->codec, is_storing); - p += serialize_uint32be(p, &entry->clusm, is_storing); - p += serialize_uint32be(p, &entry->clusa, is_storing); - p += serialize_uint32be(p, &entry->albumart_pos, is_storing); - if (is_storing) { - p += (serialize_ucs2be_string_var(p, entry->release, is_storing) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var(p, entry->album_artist, is_storing) + 1) * sizeof(ucs2char_t); - } else { - p += (serialize_ucs2be_string_var_alloc(p, &entry->release) + 1) * sizeof(ucs2char_t); - p += (serialize_ucs2be_string_var_alloc(p, &entry->album_artist) + 1) * sizeof(ucs2char_t); - } - p += serialize_uint32be(p, &entry->object_uid, is_storing); - p += serialize_uint32be(p, &entry->ratingtime, is_storing); + for (i = 0;i < list->num_entries;++i) { + dat_entry_t* entry = &list->entries[i]; + p += dat_entry_serialize(p, q, entry, is_storing); + q -= sizeof(uint32_t); } return (size_t)(p - buffer); } -static void dat_musics_dump(FILE *fp, dat_musics_t* musics) +static void dat_list_dump(dat_list_t* list, FILE *fp, const dic_list_t* dic_list) { uint32_t i; - fprintf(fp, "MUSICS {\n"); - fprintf(fp, " size: 0x%08X\n", musics->size); - fprintf(fp, " num_entries: %d\n", musics->num_entries); - fprintf(fp, " unknown1: 0x%08X\n", musics->unknown1); - fprintf(fp, " unknown2: 0x%08X\n", musics->unknown2); + fprintf(fp, " size: 0x%08X\n", list->size); + fprintf(fp, " num_entries: %d\n", list->num_entries); + fprintf(fp, " unknown1: 0x%08X\n", list->unknown1); + fprintf(fp, " unknown2: 0x%08X\n", list->unknown2); - for (i = 0;i < musics->num_entries;++i) { - dat_music_t* entry = &musics->entries[i]; - - fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, musics->offsets[i]); - fprints(fp, " artist: %s\n", entry->artist); - fprints(fp, " album: %s\n", entry->album); - fprints(fp, " genre: %s\n", entry->genre); - fprints(fp, " title: %s\n", entry->title); - fprints(fp, " filepath: %s\n", entry->filepath); - fprints(fp, " filename: %s\n", entry->filename); - fprintf(fp, " duration: %d\n", entry->duration); - fprintf(fp, " rating: %d\n", entry->rating); - fprintf(fp, " use_count: %d\n", entry->use_count); - fprintf(fp, " format: 0x%04X\n", entry->format); - fprintf(fp, " tracknumber: %d\n", entry->tracknumber); - fprintf(fp, " drm: 0x%02X\n", entry->drm); - fprintf(fp, " lyric: 0x%02X\n", entry->lyric); - fprintf(fp, " purchase: 0x%02X\n", entry->purchase); - fprintf(fp, " protection: 0x%04X\n", entry->protection); - fprintf(fp, " samplerate: %d\n", entry->samplerate); - fprintf(fp, " bitrate: %d\n", entry->bitrate); - fprintf(fp, " changed_flag: 0x%02X\n", entry->changed_flag); - fprintf(fp, " codec: 0x%08X\n", entry->codec); - fprintf(fp, " clusm: 0x%08X\n", entry->clusm); - fprintf(fp, " clusa: 0x%08X\n", entry->clusa); - fprintf(fp, " albumart_pos: 0x%08X\n", entry->albumart_pos); - fprints(fp, " release: %s\n", entry->release); - fprints(fp, " album_artist: %s\n", entry->album_artist); - fprintf(fp, " object_uid: %d\n", entry->object_uid); - fprintf(fp, " ratingtime: %d\n", entry->ratingtime); + for (i = 0;i < list->num_entries;++i) { + dat_entry_t* entry = &list->entries[i]; + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, entry->offset); + dat_entry_dump(entry, fp, dic_list); fprintf(fp, " }\n"); } - fprintf(fp, "}\n"); } dat_t* dat_new() { dat_t* dat = (dat_t*)malloc(sizeof(dat_t)); if (dat) { - dat_objects_init(&dat->objects); - dat_musics_init(&dat->musics); + dat_list_init(&dat->objects); + dat_list_init(&dat->musics); } return dat; } void dat_finish(dat_t* dat) { - dat_objects_finish(&dat->objects); - dat_musics_finish(&dat->musics); + dat_list_finish(&dat->objects); + dat_list_finish(&dat->musics); free(dat); } -size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing) +size_t dat_serialize(dat_t* dat, const dic_t* dic, uint8_t* buffer, int is_storing) { - dat_objects_serialize(buffer, &dat->objects, is_storing); - dat_musics_serialize(buffer + 0x00020000, &dat->musics, is_storing); + dat_list_serialize(buffer, &dat->objects, is_storing, &dic->objects); + dat_list_serialize(buffer + 0x00020000, &dat->musics, is_storing, &dic->music); return 0; } -void dat_dump(FILE *fp, dat_t* dat) +void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp) { fprintf(fp, "===== db.dat =====\n"); - dat_objects_dump(fp, &dat->objects); - dat_musics_dump(fp, &dat->musics); + fprintf(fp, "OBJECTS = {\n"); + dat_list_dump(&dat->objects, fp, &dic->objects); + fprintf(fp, "}\n"); + fprintf(fp, "MUSIC = {\n"); + dat_list_dump(&dat->musics, fp, &dic->music); + fprintf(fp, "}\n"); } Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 18:03:21 UTC (rev 197) @@ -25,75 +25,28 @@ #define __IP3DB_DAT_H__ typedef struct { - uint32_t uid; - uint32_t parent_uid; - uint8_t properties; - uint16_t filetype; - ucs2char_t* object_name; - ucs2char_t* name; - uint32_t filesize; - uint32_t datecrea; - uint32_t rawid; - uint32_t puoid1; - uint32_t puoid2; -} dat_object_t; + int num_fields; + ip3db_variant_t *fields; + uint32_t offset; +} dat_entry_t; typedef struct { uint32_t size; uint32_t num_entries; uint32_t unknown1; uint32_t unknown2; - dat_object_t* entries; - uint32_t* offsets; -} dat_objects_t; + dat_entry_t* entries; +} dat_list_t; -typedef struct { - ucs2char_t* artist; - ucs2char_t* album; - ucs2char_t* genre; - ucs2char_t* title; - ucs2char_t* filepath; - ucs2char_t* filename; - uint32_t duration; - uint16_t rating; - uint32_t use_count; - uint16_t format; - uint16_t tracknumber; - uint8_t drm; - uint8_t lyric; - uint8_t purchase; - uint16_t protection; - uint32_t samplerate; - uint32_t bitrate; - uint8_t changed_flag; - uint32_t codec; - uint32_t clusm; - uint32_t clusa; - uint32_t albumart_pos; - ucs2char_t* release; - ucs2char_t* album_artist; - uint32_t object_uid; - uint32_t ratingtime; -} dat_music_t; - -typedef struct { - uint32_t size; - uint32_t num_entries; - uint32_t unknown1; - uint32_t unknown2; - dat_music_t* entries; - uint32_t* offsets; -} dat_musics_t; - struct tag_dat_t { - dat_objects_t objects; - dat_musics_t musics; + dat_list_t objects; + dat_list_t musics; }; typedef struct tag_dat_t dat_t; dat_t* dat_new(); void dat_finish(dat_t* dat); -size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing); -void dat_dump(FILE *fp, dat_t* dat); +size_t dat_serialize(dat_t* dat, const dic_t* dic, uint8_t* buffer, int is_storing); +void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp); #endif/*__IP3DB_DAT_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 18:03:21 UTC (rev 197) @@ -42,15 +42,60 @@ #include "ip3db.h" #include "dic.h" +static void dic_entry_init(dic_entry_t* entry) +{ + memset(entry, 0, sizeof(*entry)); +} + +static void dic_entry_finish(dic_entry_t* entry) +{ + ucs2free(entry->name); + dic_entry_init(entry); +} + +static void dic_entry_dump(const dic_entry_t* entry, FILE *fp) +{ + fprintf(fp, " next: 0x%08X\n", entry->next); + fprintf(fp, " type: 0x%08X\n", entry->type); + fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); + fprints(fp, " name: %s\n", entry->name); +} + +static void dic_list_init(dic_list_t* list) +{ + memset(list, 0, sizeof(*list)); +} + +static void dic_list_finish(dic_list_t* list) +{ + int i; + for (i = 0;i < list->num_fields;++i) { + dic_entry_finish(&list->fields[i]); + } + free(list->fields); +} + +static void dic_list_dump(dic_list_t* list, FILE *fp) +{ + int i; + for (i = 0;i < list->num_fields;++i) { + const dic_entry_t* entry = &list->fields[i]; + fprintf(fp, " FIELD %d = {\n", i); + dic_entry_dump(entry, fp); + fprintf(fp, " }\n"); + } +} + dic_t* dic_new() { dic_t* dic = (dic_t*)malloc(sizeof(dic_t)); if (dic) { - memset(dic, 0, sizeof(*dic)); - dic->num_music_fields = IP3DBF_MUSIC_LAST; - dic->music_fields = (dic_entry_t*)calloc(dic->num_music_fields, sizeof(dic_entry_t)); - dic->num_objects_fields = IP3DBF_OBJECTS_LAST; - dic->objects_fields = (dic_entry_t*)calloc(dic->num_objects_fields, sizeof(dic_entry_t)); + dic_list_init(&dic->music); + dic->music.num_fields = IP3DBF_MUSIC_LAST; + dic->music.fields = (dic_entry_t*)calloc(dic->music.num_fields, sizeof(dic_entry_t)); + dic_list_init(&dic->objects); + dic->objects.num_fields = IP3DBF_OBJECTS_LAST; + dic->objects.fields = (dic_entry_t*)calloc(dic->objects.num_fields, sizeof(dic_entry_t)); } return dic; } @@ -58,13 +103,13 @@ void dic_finish(dic_t* dic) { if (dic) { - free(dic->music_fields); - free(dic->objects_fields); + dic_list_finish(&dic->music); + dic_list_finish(&dic->objects); free(dic); } } -static size_t dic_serialize_field(uint8_t* block, dic_entry_t* entry, int is_storing) +static size_t dic_serialize_entry(uint8_t* block, dic_entry_t* entry, int is_storing) { uint8_t *p = block; p += serialize_uint32be(p, &entry->next, 0); @@ -83,16 +128,16 @@ int i; uint32_t next = 0; - next = 0x00000056; - for (i = 0;i < IP3DBF_MUSIC_LAST;++i) { - dic_serialize_field(buffer + next, &dic->music_fields[i], is_storing); - next = dic->music_fields[i].next; + next = 0x0000003C; + for (i = 0;i < dic->music.num_fields;++i) { + dic_serialize_entry(buffer + next, &dic->music.fields[i], is_storing); + next = dic->music.fields[i].next; } next = 0x0000099A; - for (i = 0;i < IP3DBF_OBJECTS_LAST;++i) { - dic_serialize_field(buffer + next, &dic->objects_fields[i], is_storing); - next = dic->objects_fields[i].next; + for (i = 0;i < dic->objects.num_fields;++i) { + dic_serialize_entry(buffer + next, &dic->objects.fields[i], is_storing); + next = dic->objects.fields[i].next; } return 0; @@ -100,34 +145,11 @@ void dic_dump(dic_t* dic, FILE *fp) { - int i; - fprintf(fp, "===== db.dic =====\n"); - fprintf(fp, "MUSIC {\n"); - for (i = 0;i < IP3DBF_MUSIC_LAST;++i) { - const dic_entry_t* entry = &dic->music_fields[i]; - fprintf(fp, " FIELD %d = {\n", i); - fprintf(fp, " next: 0x%08X\n", entry->next); - fprintf(fp, " type: 0x%08X\n", entry->type); - fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); - fprints(fp, " name: %s\n", entry->name); - fprintf(fp, " }\n"); - } - fprintf(fp, "}\n"); - + dic_list_dump(&dic->music, fp); fprintf(fp, "OBJECTS {\n"); - for (i = 0;i < IP3DBF_OBJECTS_LAST;++i) { - const dic_entry_t* entry = &dic->objects_fields[i]; - fprintf(fp, " FIELD %d = {\n", i); - fprintf(fp, " next: 0x%08X\n", entry->next); - fprintf(fp, " type: 0x%08X\n", entry->type); - fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); - fprints(fp, " name: %s\n", entry->name); - fprintf(fp, " }\n"); - } - fprintf(fp, "}\n"); - + dic_list_dump(&dic->objects, fp); fprintf(fp, "\n"); } Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 18:03:21 UTC (rev 197) @@ -31,11 +31,14 @@ ucs2char_t* name; } dic_entry_t; +typedef struct { + int num_fields; + dic_entry_t *fields; +} dic_list_t; + struct tag_dic_t { - int num_music_fields; - dic_entry_t *music_fields; - int num_objects_fields; - dic_entry_t *objects_fields; + dic_list_t music; + dic_list_t objects; }; typedef struct tag_dic_t dic_t; Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 18:03:21 UTC (rev 197) @@ -88,20 +88,6 @@ return sizeof(tail_t); } -void variant_init(ip3db_variant_t* var, int type) -{ - memset(var, 0, sizeof(*var)); - var->type = type; -} - -void variant_finish(ip3db_variant_t* var) -{ - if (var->type == IP3DBVT_STRING) { - ucs2free(var->value.str); - } - variant_init(var, IP3DBVT_NONE); -} - /** * Prototype definition of a callback function for idx_walk. * @param buffer The pointer to the index buffer. @@ -147,7 +133,7 @@ } /* Read the key value. */ - variant_init(&key, type); + ip3db_variant_init(&key, type); switch (type) { case IP3DBVT_BYTE: p += serialize_uint8(p, &key.value.byte, 0); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 18:03:21 UTC (rev 197) @@ -32,8 +32,8 @@ #include "util.h" #include "ip3db.h" +#include "dic.h" #include "dat.h" -#include "dic.h" static ip3db_index_param_t ip3db_index_param[IP3DBIDX_LAST] = { {"Music.Title", 0x0086, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, @@ -54,6 +54,20 @@ {"Object.FileType-ParentUid-Properties", 0x0ACE, {IP3DBVT_WORD, IP3DBVT_DWORD, IP3DBVT_BYTE}}, }; +void ip3db_variant_init(ip3db_variant_t* var, int type) +{ + memset(var, 0, sizeof(*var)); + var->type = type; +} + +void ip3db_variant_finish(ip3db_variant_t* var) +{ + if (var->type == IP3DBVT_STRING) { + ucs2free(var->value.str); + } + ip3db_variant_init(var, IP3DBVT_NONE); +} + ip3db_index_param_t* ip3db_get_indexparam(int field) { return &ip3db_index_param[field]; @@ -109,7 +123,7 @@ return 1; } - if (dat_serialize(db->dat_buffer, db->dat, 0) != 0) { + if (dat_serialize(db->dat, db->dic, db->dat_buffer, 0) != 0) { ip3db_finish(db); return 1; } @@ -123,7 +137,7 @@ dic_dump(db->dic, fpo); /* Dump db.dat */ - dat_dump(fpo, db->dat); + dat_dump(db->dat, db->dic, fpo); /* Dump db.idx */ idx_dump(fpo, db); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 15:38:22 UTC (rev 196) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 18:03:21 UTC (rev 197) @@ -97,6 +97,7 @@ IP3DBF_MUSIC_CLUSA, IP3DBF_MUSIC_ALBUMARTPOS, IP3DBF_MUSIC_ORGRELEASEDATE, + IP3DBF_MUSIC_ALBUMARTIST, IP3DBF_MUSIC_UID, IP3DBF_MUSIC_RATINGTIME, IP3DBF_MUSIC_LAST, @@ -146,6 +147,9 @@ ip3db_index_param_t* ip3db_get_indexparam(int field); +void ip3db_variant_init(ip3db_variant_t* var, int type); +void ip3db_variant_finish(ip3db_variant_t* var); + void ip3db_init(ip3db_t* db); void ip3db_finish(ip3db_t* db); result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 15:38:22
|
Revision: 196 http://svn.sourceforge.net/pmplib/?rev=196&view=rev Author: nyaochi Date: 2006-12-24 07:38:22 -0800 (Sun, 24 Dec 2006) Log Message: ----------- Read and dump routines for db.dic Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 15:38:22 UTC (rev 196) @@ -19,16 +19,16 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __IP3DB_DAT_H__ #define __IP3DB_DAT_H__ typedef struct { - uint32_t uid; - uint32_t parent_uid; - uint8_t properties; - uint16_t filetype; + uint32_t uid; + uint32_t parent_uid; + uint8_t properties; + uint16_t filetype; ucs2char_t* object_name; ucs2char_t* name; uint32_t filesize; @@ -48,32 +48,32 @@ } dat_objects_t; typedef struct { - ucs2char_t* artist; - ucs2char_t* album; - ucs2char_t* genre; - ucs2char_t* title; - ucs2char_t* filepath; - ucs2char_t* filename; - uint32_t duration; - uint16_t rating; - uint32_t use_count; - uint16_t format; - uint16_t tracknumber; - uint8_t drm; - uint8_t lyric; - uint8_t purchase; - uint16_t protection; - uint32_t samplerate; - uint32_t bitrate; - uint8_t changed_flag; - uint32_t codec; - uint32_t clusm; - uint32_t clusa; - uint32_t albumart_pos; - ucs2char_t* release; - ucs2char_t* album_artist; - uint32_t object_uid; - uint32_t ratingtime; + ucs2char_t* artist; + ucs2char_t* album; + ucs2char_t* genre; + ucs2char_t* title; + ucs2char_t* filepath; + ucs2char_t* filename; + uint32_t duration; + uint16_t rating; + uint32_t use_count; + uint16_t format; + uint16_t tracknumber; + uint8_t drm; + uint8_t lyric; + uint8_t purchase; + uint16_t protection; + uint32_t samplerate; + uint32_t bitrate; + uint8_t changed_flag; + uint32_t codec; + uint32_t clusm; + uint32_t clusa; + uint32_t albumart_pos; + ucs2char_t* release; + ucs2char_t* album_artist; + uint32_t object_uid; + uint32_t ratingtime; } dat_music_t; typedef struct { Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 15:38:22 UTC (rev 196) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ /* Some important findings from db.dic: @@ -38,17 +38,99 @@ #include <ucs2char.h> #include "serialize.h" +#include "util.h" #include "ip3db.h" +#include "dic.h" -/* -typedef struct { - uint32_t next; - uint32_t type; - uint32_t idx_root; - ucs2char_t* name; -} dic_entry_t; -*/ +dic_t* dic_new() +{ + dic_t* dic = (dic_t*)malloc(sizeof(dic_t)); + if (dic) { + memset(dic, 0, sizeof(*dic)); + dic->num_music_fields = IP3DBF_MUSIC_LAST; + dic->music_fields = (dic_entry_t*)calloc(dic->num_music_fields, sizeof(dic_entry_t)); + dic->num_objects_fields = IP3DBF_OBJECTS_LAST; + dic->objects_fields = (dic_entry_t*)calloc(dic->num_objects_fields, sizeof(dic_entry_t)); + } + return dic; +} +void dic_finish(dic_t* dic) +{ + if (dic) { + free(dic->music_fields); + free(dic->objects_fields); + free(dic); + } +} + +static size_t dic_serialize_field(uint8_t* block, dic_entry_t* entry, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &entry->next, 0); + p += serialize_uint32be(p, &entry->type, 0); + p += serialize_uint32be(p, &entry->idx_root, 0); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); + } + return (size_t)(p - block); +} + +int dic_serialize(dic_t* dic, uint8_t* buffer, int is_storing) +{ + int i; + uint32_t next = 0; + + next = 0x00000056; + for (i = 0;i < IP3DBF_MUSIC_LAST;++i) { + dic_serialize_field(buffer + next, &dic->music_fields[i], is_storing); + next = dic->music_fields[i].next; + } + + next = 0x0000099A; + for (i = 0;i < IP3DBF_OBJECTS_LAST;++i) { + dic_serialize_field(buffer + next, &dic->objects_fields[i], is_storing); + next = dic->objects_fields[i].next; + } + + return 0; +} + +void dic_dump(dic_t* dic, FILE *fp) +{ + int i; + + fprintf(fp, "===== db.dic =====\n"); + + fprintf(fp, "MUSIC {\n"); + for (i = 0;i < IP3DBF_MUSIC_LAST;++i) { + const dic_entry_t* entry = &dic->music_fields[i]; + fprintf(fp, " FIELD %d = {\n", i); + fprintf(fp, " next: 0x%08X\n", entry->next); + fprintf(fp, " type: 0x%08X\n", entry->type); + fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); + fprints(fp, " name: %s\n", entry->name); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); + + fprintf(fp, "OBJECTS {\n"); + for (i = 0;i < IP3DBF_OBJECTS_LAST;++i) { + const dic_entry_t* entry = &dic->objects_fields[i]; + fprintf(fp, " FIELD %d = {\n", i); + fprintf(fp, " next: 0x%08X\n", entry->next); + fprintf(fp, " type: 0x%08X\n", entry->type); + fprintf(fp, " idx_root: 0x%08X\n", entry->idx_root); + fprints(fp, " name: %s\n", entry->name); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); + + fprintf(fp, "\n"); +} + uint32_t dic_get_idxroot(uint8_t *buffer, int field) { uint32_t value; Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 15:38:22 UTC (rev 196) @@ -19,11 +19,31 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __IP3DB_DIC_H__ #define __IP3DB_DIC_H__ +typedef struct { + uint32_t next; + uint32_t type; + uint32_t idx_root; + ucs2char_t* name; +} dic_entry_t; + +struct tag_dic_t { + int num_music_fields; + dic_entry_t *music_fields; + int num_objects_fields; + dic_entry_t *objects_fields; +}; +typedef struct tag_dic_t dic_t; + +dic_t* dic_new(); +void dic_finish(dic_t* dic); +int dic_serialize(dic_t* dic, uint8_t* buffer, int is_storing); +void dic_dump(dic_t* dic, FILE *fp); + uint32_t dic_get_idxroot(uint8_t *buffer, int field); #endif/*__IP3DB_DIC_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 15:38:22 UTC (rev 196) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ /* Brief summary of db.idx structure: @@ -61,16 +61,6 @@ uint32_t next; } tail_t; -typedef struct { - uint32_t type; - union { - uint8_t byte; - uint16_t word; - uint32_t dword; - ucs2char_t* str; - } value; -} variant_t; - static size_t idx_serialize_header(uint8_t *block, header_t *header, int is_storing) { uint8_t *p = block; @@ -98,13 +88,13 @@ return sizeof(tail_t); } -void variant_init(variant_t* var, int type) +void variant_init(ip3db_variant_t* var, int type) { memset(var, 0, sizeof(*var)); var->type = type; } -void variant_finish(variant_t* var) +void variant_finish(ip3db_variant_t* var) { if (var->type == IP3DBVT_STRING) { ucs2free(var->value.str); @@ -127,7 +117,7 @@ uint8_t* buffer, uint32_t offset, node_t* node, - variant_t* key, + ip3db_variant_t* key, int* types, int level, int flag, @@ -144,7 +134,7 @@ ) { node_t node; - variant_t key; + ip3db_variant_t key; int type = types[level]; uint8_t* p = buffer + offset; @@ -203,7 +193,7 @@ uint8_t* buffer, uint32_t offset, node_t* node, - variant_t* key, + ip3db_variant_t* key, int* types, int level, int flag, Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 15:38:22 UTC (rev 196) @@ -31,8 +31,9 @@ #include <ucs2char.h> #include "util.h" +#include "ip3db.h" #include "dat.h" -#include "ip3db.h" +#include "dic.h" static ip3db_index_param_t ip3db_index_param[IP3DBIDX_LAST] = { {"Music.Title", 0x0086, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, @@ -61,10 +62,14 @@ void ip3db_init(ip3db_t* db) { memset(db, 0, sizeof(*db)); + db->dat = dat_new(); + db->dic = dic_new(); } void ip3db_finish(ip3db_t* db) { + dic_finish(db->dic); + dat_finish(db->dat); free(db->dat_buffer); free(db->dic_buffer); free(db->idx_buffer); @@ -74,7 +79,6 @@ result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn) { FILE *fp = 0; - ucs2char_t filename[MAX_PATH]; fp = ucs2fopen(datfn, "rb"); if (!fp) { @@ -100,18 +104,28 @@ fread_all(fp, &db->idx_buffer, &db->idx_size); fclose(fp); + if (dic_serialize(db->dic, db->dic_buffer, 0) != 0) { + ip3db_finish(db); + return 1; + } + + if (dat_serialize(db->dat_buffer, db->dat, 0) != 0) { + ip3db_finish(db); + return 1; + } + return 0; } result_t ip3db_dump(ip3db_t* db, FILE *fpo) { + /* Dump db.dic */ + dic_dump(db->dic, fpo); + /* Dump db.dat */ - dat_t* dat = dat_new(); - dat_serialize(db->dat_buffer, dat, 0); - dat_dump(fpo, dat); - dat_finish(dat); + dat_dump(fpo, db->dat); /* Dump db.idx */ idx_dump(fpo, db); return 0; -} \ No newline at end of file +} Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 05:09:19 UTC (rev 195) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 15:38:22 UTC (rev 196) @@ -48,15 +48,79 @@ IP3DBIDX_MAX_KEYLEVEL = 3, }; +/** + * Field type IDs used in db.dic (Do not change the associated values) + */ enum { - IP3DBVT_NONE, - IP3DBVT_BYTE, - IP3DBVT_WORD, - IP3DBVT_DWORD, - IP3DBVT_STRING, + IP3DBVT_NONE = 0, + IP3DBVT_STRING = 1, + IP3DBVT_BYTE = 2, + IP3DBVT_WORD = 3, + IP3DBVT_DWORD = 4, }; +/** + * Variant type for field values. + */ +typedef struct { + uint32_t type; + union { + uint8_t byte; + uint16_t word; + uint32_t dword; + ucs2char_t* str; + } value; +} ip3db_variant_t; +enum { + IP3DBF_MUSIC_BEGIN = 0, + IP3DBF_MUSIC_ARTIST = 0, + IP3DBF_MUSIC_ALBUM, + IP3DBF_MUSIC_GENRE, + IP3DBF_MUSIC_TITLE, + IP3DBF_MUSIC_FILEPATH, + IP3DBF_MUSIC_FILENAME, + IP3DBF_MUSIC_DURATION, + IP3DBF_MUSIC_RATING, + IP3DBF_MUSIC_USECOUNT, + IP3DBF_MUSIC_FILEFORMAT, + IP3DBF_MUSIC_TRACKNUMBER, + IP3DBF_MUSIC_DRM, + IP3DBF_MUSIC_LYRIC, + IP3DBF_MUSIC_PURCHASE, + IP3DBF_MUSIC_PROTECTIONSTATUS, + IP3DBF_MUSIC_SAMPLERATE, + IP3DBF_MUSIC_BITRATE, + IP3DBF_MUSIC_CHANGEDFLAG, + IP3DBF_MUSIC_AUDIOWAVECODEC, + IP3DBF_MUSIC_CLUSM, + IP3DBF_MUSIC_CLUSA, + IP3DBF_MUSIC_ALBUMARTPOS, + IP3DBF_MUSIC_ORGRELEASEDATE, + IP3DBF_MUSIC_UID, + IP3DBF_MUSIC_RATINGTIME, + IP3DBF_MUSIC_LAST, +}; + +enum { + IP3DBF_OBJECTS_BEGIN = 0, + IP3DBF_OBJECTS_UID = 0, + IP3DBF_OBJECTS_PARENTUID, + IP3DBF_OBJECTS_PROPERTIES, + IP3DBF_OBJECTS_FILETYPE, + IP3DBF_OBJECTS_OBJECTNAME, + IP3DBF_OBJECTS_NAME, + IP3DBF_OBJECTS_FILESIZE, + IP3DBF_OBJECTS_DATECREA, + IP3DBF_OBJECTS_RAWID, + IP3DBF_OBJECTS_PUOID1, + IP3DBF_OBJECTS_PUOID2, + IP3DBF_OBJECTS_LAST, +}; + + + + typedef struct { const char* name; uint32_t dic_offset; @@ -64,6 +128,7 @@ } ip3db_index_param_t; struct tag_dat_t; typedef struct tag_dat_t dat_t; +struct tag_dic_t; typedef struct tag_dic_t dic_t; typedef struct { uint8_t* dat_buffer; @@ -74,6 +139,7 @@ long idx_size; dat_t* dat; + dic_t* dic; } ip3db_t; int idx_dump(FILE *fpo, ip3db_t* db); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 05:09:19
|
Revision: 195 http://svn.sourceforge.net/pmplib/?rev=195&view=rev Author: nyaochi Date: 2006-12-23 21:09:19 -0800 (Sat, 23 Dec 2006) Log Message: ----------- [pmp_iriverplus3] - Implemented a primitive export routine for PMPlib; - "easypmp -R -L0" now works with iriver E10. Modified Paths: -------------- trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/include/pmp.h 2006-12-24 05:09:19 UTC (rev 195) @@ -49,6 +49,7 @@ PMP_DEVICENOTFOUND, PMP_NOTSUPPORTED, PMP_INSUFFICIENTMEMORY, + PMP_NOTIMPLIMENTED, PMPDBE_OUTOFMEMORY, PMPDBE_NOTFOUND, PMPDBE_INVALIDTYPE, Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 05:09:19 UTC (rev 195) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -71,18 +71,12 @@ ip3db_init(db); } -static const ucs2char_t g_ucs2cs_datdb[] = {'d','b','.','d','a','t',0}; -static const ucs2char_t g_ucs2cs_dicdb[] = {'d','b','.','d','i','c',0}; -static const ucs2char_t g_ucs2cs_idxdb[] = {'d','b','.','i','d','x',0}; - -result_t ip3db_load(ip3db_t* db, const ucs2char_t* path) +result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn) { FILE *fp = 0; ucs2char_t filename[MAX_PATH]; - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_datdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(datfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -90,9 +84,7 @@ fread_all(fp, &db->dat_buffer, &db->dat_size); fclose(fp); - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_dicdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(dicfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -100,9 +92,7 @@ fread_all(fp, &db->dic_buffer, &db->dic_size); fclose(fp); - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_idxdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(idxfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -113,7 +103,7 @@ return 0; } -result_t ip3db_dump(FILE *fpo, ip3db_t* db) +result_t ip3db_dump(ip3db_t* db, FILE *fpo) { /* Dump db.dat */ dat_t* dat = dat_new(); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 05:09:19 UTC (rev 195) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __IP3DB_IP3DB_H__ #define __IP3DB_IP3DB_H__ @@ -82,7 +82,7 @@ void ip3db_init(ip3db_t* db); void ip3db_finish(ip3db_t* db); -result_t ip3db_load(ip3db_t* db, const ucs2char_t* path); -result_t ip3db_dump(FILE *fpo, ip3db_t* db); +result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); +result_t ip3db_dump(ip3db_t* db, FILE *fpo); #endif /*_IP3DB_IP3DB_H__*/ Added: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-24 05:09:19 UTC (rev 195) @@ -0,0 +1,561 @@ +/* + * PMP library implementation for iriver E10. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <filepath.h> +#include <pmp.h> +#include <pmphelp.h> + +#include "ip3db.h" + +#ifdef PMP_IRIVERPLUS3_EXPORTS +#define PMPIRIVERPLUS3API __declspec(dllexport) +#else +#define PMPIRIVERPLUS3API +#endif + + +typedef struct { + const char *id; + const char *name; + const char *mode; + const char *min_version; + const char *max_version; + const char *sys_filename; + const char *dat_filename; + const char *dic_filename; + const char *idx_filename; + const char *path_to_music; + const char *path_to_playlist; + const char *playlist_ext; +} ip3model_descriptor_t; + +static const ip3model_descriptor_t g_model_descriptions[] = { + { + "iriver_e10_ums_1.04", "E10 UMS", "UM", + "1.04", "1.04", + "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", + "\\", "Playlists\\", + ".plp", + }, + { + NULL, NULL, NULL, + NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, + NULL, + }, +}; + +typedef struct { + char id[128]; + char name[128]; + char mode[128]; + char language[128]; + char version[128]; + + ucs2char_t path_to_root[MAX_PATH]; + ucs2char_t path_to_music[MAX_PATH]; + ucs2char_t path_to_playlist[MAX_PATH]; + ucs2char_t sys_filename[MAX_PATH]; + ucs2char_t dat_filename[MAX_PATH]; + ucs2char_t dic_filename[MAX_PATH]; + ucs2char_t idx_filename[MAX_PATH]; + ucs2char_t playlist_ext[MAX_PATH]; +} ip3_environment_t; + + +typedef struct { + ip3_environment_t env; +} pmp_internal_t; + +typedef struct { + ip3db_t ip3db; +} pmpdb_internal_t; + +typedef struct { + ip3db_t ip3db; +} pmppl_internal_t; + + +static uint32_t pmp_add_ref(pmp_t* pmp); +static uint32_t pmp_release(pmp_t* pmp); +static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); +static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); +static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); +static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); + +static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb); +static uint32_t pmpdb_release(pmpdb_t* pmpdb); +static result_t pmpdb_read(pmpdb_t* pmpdb); +static result_t pmpdb_write(pmpdb_t* pmpdb); +static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); +static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); +static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level); + +static uint32_t pmppl_add_ref(pmppl_t* pmppl); +static uint32_t pmppl_release(pmppl_t* pmppl); +static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); + + +static void set_environment( + ip3_environment_t* env, + const ip3model_descriptor_t* md, + const ucs2char_t* path_to_device + ) +{ + ucs2char_t* ucs2 = NULL; + + ucs2cpy(env->path_to_root, path_to_device); + + ucs2cpy(env->path_to_music, path_to_device); + filepath_addslash(env->path_to_music); + ucs2 = mbsdupucs2(md->path_to_music); + ucs2cat(env->path_to_music, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->path_to_playlist, path_to_device); + filepath_addslash(env->path_to_playlist); + ucs2 = mbsdupucs2(md->path_to_playlist); + ucs2cat(env->path_to_playlist, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->sys_filename, path_to_device); + filepath_addslash(env->sys_filename); + ucs2 = mbsdupucs2(md->sys_filename); + ucs2cat(env->sys_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->dat_filename, path_to_device); + filepath_addslash(env->dat_filename); + ucs2 = mbsdupucs2(md->dat_filename); + ucs2cat(env->dat_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->dic_filename, path_to_device); + filepath_addslash(env->dic_filename); + ucs2 = mbsdupucs2(md->dic_filename); + ucs2cat(env->dic_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->idx_filename, path_to_device); + filepath_addslash(env->idx_filename); + ucs2 = mbsdupucs2(md->idx_filename); + ucs2cat(env->idx_filename, ucs2); + ucs2free(ucs2); + + ucs2 = mbsdupucs2(md->playlist_ext); + ucs2cat(env->playlist_ext, ucs2); + ucs2free(ucs2); +} + +static int match_model( + const char *id, + const ucs2char_t* path_to_device, + const ip3model_descriptor_t* md, + ip3_environment_t* env + ) +{ + memset(env, 0, sizeof(*env)); + + if (!id || strcmp(md->id, id) != 0) { + return 0; + } + + set_environment(env, md, path_to_device); + return 1; +} + +static char* strip(char *str) +{ + char *p = str + strlen(str) - 1; + while (*str && isspace(*str)) { + str++; + } + while (str <= p && isspace(*p)) { + *p-- = 0; + } + return str; +} + +#define COMP(a, b) ((a)>(b))-((a)<(b)) + +static int compare_version(const char *x, const char *y) +{ + char *p = NULL, *q = NULL; + + for (;;) { + long a = strtol(x, &p, 10); + long b = strtol(y, &q, 10); + int value = COMP(a, b); + if (value != 0) { + return value; + } + if (!*p || !*q || *p != *q) { + return COMP(*p, *q); + } + x = p+1; + y = q+1; + } +} + +static int detect_model( + const ucs2char_t* path_to_device, + const ip3model_descriptor_t* md, + ip3_environment_t* env + ) +{ + ucs2char_t* ucs2 = NULL; + ucs2char_t filename[MAX_PATH]; + + memset(env, 0, sizeof(*env)); + + ucs2cpy(filename, path_to_device); + filepath_addslash(filename); + ucs2 = mbsdupucs2(md->sys_filename); + ucs2cat(filename, ucs2); + ucs2free(ucs2); + if (filepath_file_exists(filename)) { + int match = 1; + char line[128]; + FILE *fp = ucs2fopen(filename, "r"); + if (!fp) { + return 0; + } + + while (fgets(line, sizeof(line)-1, fp)) { + char *p = strip(line); + if (p[0] == '[' && line[strlen(p)-1] == ']') { + p[strlen(p)-1] = 0; + strcpy(env->name, p+1); + } else if (strncmp(p, "version = ", 10) == 0) { + /* They are too stupid to describe version "1.04" as "1.4" */ + if (strlen(p+10) == 3 && p[11] == '.') { + env->version[0] = p[10]; + env->version[1] = p[11]; + env->version[2] = '0'; + env->version[3] = p[12]; + env->version[4] = 0; + } else { + strcpy(env->version, p+10); + } + } else if (strncmp(p, "language = ", 11) == 0) { + strcpy(env->language, p+11); + } else if (strncmp(p, "mode = ", 7) == 0) { + strcpy(env->mode, p+7); + } + } + fclose(fp); + + match &= (strcmp(env->mode, md->mode) == 0); + match &= (compare_version(md->min_version, env->version) <= 0); + match &= (compare_version(env->version, md->max_version) <= 0); + + if (match) { + set_environment(env, md, path_to_device); + return 1; + } + } + return 0; +} + + + +PMPIRIVERPLUS3API result_t pmp_enumerate_devid(pmp_enumerate_devid_callback_t callback, void *instance) +{ + const ip3model_descriptor_t* md = g_model_descriptions; + for (;md->id;++md) { + callback(instance, md->id); + } + return 0; +} + +PMPIRIVERPLUS3API result_t pmp_create(pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id) +{ + result_t ret = 0; + pmp_t* pmp = NULL; + pmp_internal_t* pmpi = NULL; + const ip3model_descriptor_t* md = NULL; + ip3_environment_t env; + pmp_environment_t* pmpenv = NULL; + + *ptr_pmp = 0; + + // Find a suitable model for the device. + md = g_model_descriptions; + for (;md->id;++md) { + if (detect_model(path_to_device, md, &env)) { + if (!id || !id[0]) { + break; + } + if (strcmp(md->id, id) == 0) { + break; + } + } + if (match_model(id, path_to_device, md, &env)) { + break; + } + } + if (!md->id) { + return PMP_DEVICENOTFOUND; + } + + // Allocate PMP class instance. + pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); + if (!pmp) { + return PMPDBE_OUTOFMEMORY; + } + + pmp->add_ref = pmp_add_ref; + pmp->release = pmp_release; + pmp->create_instance_db = pmp_create_instance_db; + pmp->create_instance_pl = pmp_create_instance_pl; + pmp->is_supported_codec = pmp_is_supported_codec; + pmp->is_supported_ext = pmp_is_supported_ext; + + // Allocate the internal variables. + pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); + if (!pmpi) { + free(pmp); + return PMPDBE_OUTOFMEMORY; + } + pmp->instance = pmpi; + + // Initialize the internal variables. + memcpy(&pmpi->env, &env, sizeof(env)); + + // Initialize the (exportable) env. + pmpenv = &pmp->env; + strcpy(pmpenv->id, md->id); + strcpy(pmpenv->name, md->name); + strcpy(pmpenv->mode, md->mode); + strcpy(pmpenv->language, pmpi->env.language); + strcpy(pmpenv->version, pmpi->env.version); + pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; + ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); + pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; + ucs2cpy(pmpenv->path_to_music.path, pmpi->env.path_to_music); + pmpenv->path_to_playlist.flag = PMPPEF_SUPPORT; + ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); + ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); + + // Prepare + pmp->add_ref(pmp); + *ptr_pmp = pmp; + return 0; +} + +static uint32_t pmp_add_ref(pmp_t* pmp) +{ + return interlocked_increment(&pmp->ref_count); +} + +static uint32_t pmp_release(pmp_t* pmp) +{ + uint32_t count = interlocked_decrement(&pmp->ref_count); + if (count == 0) { + free(pmp->instance); + free(pmp); + } + return count; +} + +static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +{ + pmpdb_t* pmpdb = NULL; + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + pmpdb_internal_t* pmpdbi = NULL; + + *ptr_pmpdb = 0; + + pmpdb = calloc(1, sizeof(pmpdb_t)); + if (!pmpdb) { + return PMPDBE_OUTOFMEMORY; + } + + pmpdb->add_ref = pmpdb_add_ref; + pmpdb->release = pmpdb_release; + pmpdb->read = pmpdb_read; + pmpdb->write = pmpdb_write; + pmpdb->set = pmpdb_set; + pmpdb->get = pmpdb_get; + pmpdb->dump = pmpdb_dump; + + pmpdbi = calloc(1, sizeof(pmpdb_internal_t)); + if (!pmpdbi) { + free(pmpdb); + return PMPDBE_OUTOFMEMORY; + } + ip3db_init(&pmpdbi->ip3db); + + pmpdb->pmp = pmp; + pmpdb->instance = pmpdbi; + + pmpdb->add_ref(pmpdb); + *ptr_pmpdb = pmpdb; + return 0; +} + +static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +{ + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + pmppl_t* pmppl = NULL; + pmppl_internal_t* pmppli = NULL; + + *ptr_pmppl = 0; + return PMP_NOTIMPLIMENTED; +} + + + +static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) +{ + return ( + (codec == PMPCODEC_MPEGLAYER3) || + (codec == PMPCODEC_WMA) || + (codec == PMPCODEC_VORBIS) + ) ? 1 : 0; +} + +static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) +{ + static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; + static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; + static const ucs2char_t ucs2cs_ogg[] = {'.','o','g','g',0}; + + return ( + filepath_hasext(filename, ucs2cs_mp3) || + filepath_hasext(filename, ucs2cs_wma) || + filepath_hasext(filename, ucs2cs_ogg) + ) ? 1 : 0; +} + + + + + +static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb) +{ + return interlocked_increment(&pmpdb->ref_count); +} + +static uint32_t pmpdb_release(pmpdb_t* pmpdb) +{ + uint32_t count = interlocked_decrement(&pmpdb->ref_count); + if (count == 0) { + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + ip3db_finish(&pmpdbi->ip3db); + free(pmpdb->instance); + free(pmpdb); + } + return count; +} + +static result_t pmpdb_read(pmpdb_t* pmpdb) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return ip3db_read( + &pmpdbi->ip3db, + pmpi->env.dat_filename, + pmpi->env.dic_filename, + pmpi->env.idx_filename + ); +} + +static result_t pmpdb_write(pmpdb_t* pmpdb) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return PMP_NOTIMPLIMENTED; + //return ip2db_write(&pmpdbi->ip2db, pmpi->env.dat_filename, pmpi->env.idx_filename); +} + +static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return PMP_NOTIMPLIMENTED; + //return ip2db_set(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); +} + +static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return PMP_NOTIMPLIMENTED; + //return ip2db_get(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); +} + +static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + if (level > 0) { + return PMP_NOTIMPLIMENTED; + //return ip2db_repr(&pmpdbi->ip2db, fp); + } else { + return ip3db_dump(&pmpdbi->ip3db, fp); + } +} + + + + +static uint32_t pmppl_add_ref(pmppl_t* pmppl) +{ + return interlocked_increment(&pmppl->ref_count); +} + +static uint32_t pmppl_release(pmppl_t* pmppl) +{ + uint32_t count = interlocked_decrement(&pmppl->ref_count); + if (count == 0) { + pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; + free(pmppl->instance); + free(pmppl); + } + return count; +} + +static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) +{ + pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; + return PMP_NOTIMPLIMENTED; + /* + if (ip2db_playlist_write(&pmppli->ip2db, filename, files, num_files, pmpi->env.path_to_root) != 0) { + return PMPPLE_WRITE; + } + return 0; + */ +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 05:09:19 UTC (rev 195) @@ -17,7 +17,7 @@ <Configurations> <Configuration Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" + OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" @@ -193,6 +193,10 @@ > </File> <File + RelativePath=".\pmp_iriverplus3.c" + > + </File> + <File RelativePath=".\serialize.c" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 02:42:41
|
Revision: 194 http://svn.sourceforge.net/pmplib/?rev=194&view=rev Author: nyaochi Date: 2006-12-23 18:42:41 -0800 (Sat, 23 Dec 2006) Log Message: ----------- - Initial attempt to support iriver E10 (and possibly S10/S7) - Directory lib/pmp_iriverplus3 was added - The database structure was mostly figured out - PMPlib interface follows later - No POSIX support until database writer is ready Modified Paths: -------------- trunk/pmplib/pmp.sln Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/ trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/idx.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj trunk/pmplib/lib/pmp_iriverplus3/serialize.c trunk/pmplib/lib/pmp_iriverplus3/serialize.h trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_iriverplus3/util.h Added: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,318 @@ +/* + * Low-level library for db.dat. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +/* +Brief summary of db.dat structure: +- 0x00000000-0x0001FFFF: object (path name) chunk +- 0x00020000-0x0003FFFF: music (media information) chunk +- Each chunk has a 16-bytes header at the beginning +- Each chunk has an array of offsets to actual entries at the end (backward) +- Field names in db.dat seem to be defined in db.dic (Music and Objects) +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "dat.h" + +static void dat_object_finish(dat_object_t* entry) +{ + ucs2free(entry->object_name); + ucs2free(entry->name); +} + +static void dat_objects_init(dat_objects_t* objects) +{ + memset(objects, 0, sizeof(dat_objects_t)); +} + +static void dat_objects_finish(dat_objects_t* objects) +{ + uint32_t i; + for (i = 0;i < objects->num_entries;++i) { + dat_object_finish(&objects->entries[i]); + } + free(objects->entries); + free(objects->offsets); + dat_objects_init(objects); +} + +static size_t dat_objects_serialize(uint8_t* buffer, dat_objects_t* objects, int is_storing) +{ + uint32_t i; + uint8_t *p = buffer; + uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); + + p += serialize_uint32be(p, &objects->size, is_storing); + p += serialize_uint32be(p, &objects->num_entries, is_storing); + p += serialize_uint32be(p, &objects->unknown1, is_storing); + p += serialize_uint32be(p, &objects->unknown2, is_storing); + + if (!is_storing) { + free(objects->entries); + free(objects->offsets); + objects->entries = (dat_object_t*)calloc(objects->num_entries, sizeof(dat_object_t)); + objects->offsets = (uint32_t*)calloc(objects->num_entries, sizeof(uint32_t)); + } + + for (i = 0;i < objects->num_entries;++i) { + dat_object_t* entry = &objects->entries[i]; + + /* Read an element in the offset table. */ + q -= serialize_uint32be(q, &objects->offsets[i], is_storing); + + /* Read an entry. */ + p += serialize_uint32be(p, &entry->uid, is_storing); + p += serialize_uint32be(p, &entry->parent_uid, is_storing); + p += serialize_uint8(p, &entry->properties, is_storing); + p += serialize_uint16be(p, &entry->filetype, is_storing); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->object_name, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->object_name) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->filesize, is_storing); + p += serialize_uint32be(p, &entry->datecrea, is_storing); + p += serialize_uint32be(p, &entry->rawid, is_storing); + p += serialize_uint32be(p, &entry->puoid1, is_storing); + p += serialize_uint32be(p, &entry->puoid2, is_storing); + } + + return (size_t)(p - buffer); +} + +static void dat_objects_dump(FILE *fp, dat_objects_t* objects) +{ + uint32_t i; + + fprintf(fp, "OBJECTS {\n"); + fprintf(fp, " size: 0x%08X\n", objects->size); + fprintf(fp, " num_entries: %d\n", objects->num_entries); + fprintf(fp, " unknown1: 0x%08X\n", objects->unknown1); + fprintf(fp, " unknown2: 0x%08X\n", objects->unknown2); + + for (i = 0;i < objects->num_entries;++i) { + dat_object_t* entry = &objects->entries[i]; + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, objects->offsets[i]); + fprintf(fp, " uid: %d\n", entry->uid); + fprintf(fp, " parent_uid: %d\n", entry->parent_uid); + fprintf(fp, " properties: 0x%02X\n", entry->properties); + fprintf(fp, " filetype: 0x%04X\n", entry->filetype); + fprints(fp, " object_name: %s\n", entry->object_name); + fprints(fp, " name: %s\n", entry->name); + fprintf(fp, " filesize: %d\n", entry->filesize); + fprintf(fp, " datecrea: %d\n", entry->datecrea); + fprintf(fp, " rawid: %d\n", entry->rawid); + fprintf(fp, " puoid1: %d\n", entry->puoid1); + fprintf(fp, " puoid2: %d\n", entry->puoid2); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); +} + + + +static void dat_music_finish(dat_music_t* entry) +{ + ucs2free(entry->artist); + ucs2free(entry->album); + ucs2free(entry->genre); + ucs2free(entry->title); + ucs2free(entry->filepath); + ucs2free(entry->filename); + ucs2free(entry->release); + ucs2free(entry->album_artist); +} + +static void dat_musics_init(dat_musics_t* musics) +{ + memset(musics, 0, sizeof(dat_musics_t)); +} + +static void dat_musics_finish(dat_musics_t* musics) +{ + uint32_t i; + for (i = 0;i < musics->num_entries;++i) { + dat_music_finish(&musics->entries[i]); + } + free(musics->entries); + free(musics->offsets); + dat_musics_init(musics); +} + +static size_t dat_musics_serialize(uint8_t* buffer, dat_musics_t* musics, int is_storing) +{ + uint32_t i; + uint8_t *p = buffer; + uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); + + p += serialize_uint32be(p, &musics->size, is_storing); + p += serialize_uint32be(p, &musics->num_entries, is_storing); + p += serialize_uint32be(p, &musics->unknown1, is_storing); + p += serialize_uint32be(p, &musics->unknown2, is_storing); + + if (!is_storing) { + free(musics->entries); + free(musics->offsets); + musics->entries = (dat_music_t*)calloc(musics->num_entries, sizeof(dat_music_t)); + musics->offsets = (uint32_t*)calloc(musics->num_entries, sizeof(uint32_t)); + } + + for (i = 0;i < musics->num_entries;++i) { + dat_music_t* entry = &musics->entries[i]; + + /* Read an element in the offset table. */ + q -= serialize_uint32be(q, &musics->offsets[i], is_storing); + + /* Read an entry. */ + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->artist, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->album, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->genre, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->title, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->filepath, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->filename, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->artist) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->album) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->genre) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->title) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->filepath) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->filename) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->duration, is_storing); + p += serialize_uint16be(p, &entry->rating, is_storing); + p += serialize_uint32be(p, &entry->use_count, is_storing); + p += serialize_uint16be(p, &entry->format, is_storing); + p += serialize_uint16be(p, &entry->tracknumber, is_storing); + p += serialize_uint8(p, &entry->drm, is_storing); + p += serialize_uint8(p, &entry->lyric, is_storing); + p += serialize_uint8(p, &entry->purchase, is_storing); + p += serialize_uint16be(p, &entry->protection, is_storing); + p += serialize_uint32be(p, &entry->samplerate, is_storing); + p += serialize_uint32be(p, &entry->bitrate, is_storing); + p += serialize_uint8(p, &entry->changed_flag, is_storing); + p += serialize_uint32be(p, &entry->codec, is_storing); + p += serialize_uint32be(p, &entry->clusm, is_storing); + p += serialize_uint32be(p, &entry->clusa, is_storing); + p += serialize_uint32be(p, &entry->albumart_pos, is_storing); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->release, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->album_artist, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->release) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->album_artist) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->object_uid, is_storing); + p += serialize_uint32be(p, &entry->ratingtime, is_storing); + } + + return (size_t)(p - buffer); +} + +static void dat_musics_dump(FILE *fp, dat_musics_t* musics) +{ + uint32_t i; + + fprintf(fp, "MUSICS {\n"); + fprintf(fp, " size: 0x%08X\n", musics->size); + fprintf(fp, " num_entries: %d\n", musics->num_entries); + fprintf(fp, " unknown1: 0x%08X\n", musics->unknown1); + fprintf(fp, " unknown2: 0x%08X\n", musics->unknown2); + + for (i = 0;i < musics->num_entries;++i) { + dat_music_t* entry = &musics->entries[i]; + + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, musics->offsets[i]); + fprints(fp, " artist: %s\n", entry->artist); + fprints(fp, " album: %s\n", entry->album); + fprints(fp, " genre: %s\n", entry->genre); + fprints(fp, " title: %s\n", entry->title); + fprints(fp, " filepath: %s\n", entry->filepath); + fprints(fp, " filename: %s\n", entry->filename); + fprintf(fp, " duration: %d\n", entry->duration); + fprintf(fp, " rating: %d\n", entry->rating); + fprintf(fp, " use_count: %d\n", entry->use_count); + fprintf(fp, " format: 0x%04X\n", entry->format); + fprintf(fp, " tracknumber: %d\n", entry->tracknumber); + fprintf(fp, " drm: 0x%02X\n", entry->drm); + fprintf(fp, " lyric: 0x%02X\n", entry->lyric); + fprintf(fp, " purchase: 0x%02X\n", entry->purchase); + fprintf(fp, " protection: 0x%04X\n", entry->protection); + fprintf(fp, " samplerate: %d\n", entry->samplerate); + fprintf(fp, " bitrate: %d\n", entry->bitrate); + fprintf(fp, " changed_flag: 0x%02X\n", entry->changed_flag); + fprintf(fp, " codec: 0x%08X\n", entry->codec); + fprintf(fp, " clusm: 0x%08X\n", entry->clusm); + fprintf(fp, " clusa: 0x%08X\n", entry->clusa); + fprintf(fp, " albumart_pos: 0x%08X\n", entry->albumart_pos); + fprints(fp, " release: %s\n", entry->release); + fprints(fp, " album_artist: %s\n", entry->album_artist); + fprintf(fp, " object_uid: %d\n", entry->object_uid); + fprintf(fp, " ratingtime: %d\n", entry->ratingtime); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); +} + +dat_t* dat_new() +{ + dat_t* dat = (dat_t*)malloc(sizeof(dat_t)); + if (dat) { + dat_objects_init(&dat->objects); + dat_musics_init(&dat->musics); + } + return dat; +} + +void dat_finish(dat_t* dat) +{ + dat_objects_finish(&dat->objects); + dat_musics_finish(&dat->musics); + free(dat); +} + +size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing) +{ + dat_objects_serialize(buffer, &dat->objects, is_storing); + dat_musics_serialize(buffer + 0x00020000, &dat->musics, is_storing); + return 0; +} + +void dat_dump(FILE *fp, dat_t* dat) +{ + fprintf(fp, "===== db.dat =====\n"); + dat_objects_dump(fp, &dat->objects); + dat_musics_dump(fp, &dat->musics); +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,99 @@ +/* + * Low-level library for db.dat. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifndef __IP3DB_DAT_H__ +#define __IP3DB_DAT_H__ + +typedef struct { + uint32_t uid; + uint32_t parent_uid; + uint8_t properties; + uint16_t filetype; + ucs2char_t* object_name; + ucs2char_t* name; + uint32_t filesize; + uint32_t datecrea; + uint32_t rawid; + uint32_t puoid1; + uint32_t puoid2; +} dat_object_t; + +typedef struct { + uint32_t size; + uint32_t num_entries; + uint32_t unknown1; + uint32_t unknown2; + dat_object_t* entries; + uint32_t* offsets; +} dat_objects_t; + +typedef struct { + ucs2char_t* artist; + ucs2char_t* album; + ucs2char_t* genre; + ucs2char_t* title; + ucs2char_t* filepath; + ucs2char_t* filename; + uint32_t duration; + uint16_t rating; + uint32_t use_count; + uint16_t format; + uint16_t tracknumber; + uint8_t drm; + uint8_t lyric; + uint8_t purchase; + uint16_t protection; + uint32_t samplerate; + uint32_t bitrate; + uint8_t changed_flag; + uint32_t codec; + uint32_t clusm; + uint32_t clusa; + uint32_t albumart_pos; + ucs2char_t* release; + ucs2char_t* album_artist; + uint32_t object_uid; + uint32_t ratingtime; +} dat_music_t; + +typedef struct { + uint32_t size; + uint32_t num_entries; + uint32_t unknown1; + uint32_t unknown2; + dat_music_t* entries; + uint32_t* offsets; +} dat_musics_t; + +struct tag_dat_t { + dat_objects_t objects; + dat_musics_t musics; +}; +typedef struct tag_dat_t dat_t; + +dat_t* dat_new(); +void dat_finish(dat_t* dat); +size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing); +void dat_dump(FILE *fp, dat_t* dat); + +#endif/*__IP3DB_DAT_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,59 @@ +/* + * Low-level library for db.dic. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +/* +Some important findings from db.dic: +- This file seems to define field names/types in a database. +- This file stores offset addresses of root nodes in db.idx. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "ip3db.h" + +/* +typedef struct { + uint32_t next; + uint32_t type; + uint32_t idx_root; + ucs2char_t* name; +} dic_entry_t; +*/ + +uint32_t dic_get_idxroot(uint8_t *buffer, int field) +{ + uint32_t value; + ip3db_index_param_t* index_param = ip3db_get_indexparam(field); + uint8_t *p = buffer + index_param->dic_offset; + serialize_uint32be(p + sizeof(uint32_t) * 2, &value, 0); + return value; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dic.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,29 @@ +/* + * Low-level library for db.dic. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifndef __IP3DB_DIC_H__ +#define __IP3DB_DIC_H__ + +uint32_t dic_get_idxroot(uint8_t *buffer, int field); + +#endif/*__IP3DB_DIC_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dic.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,292 @@ +/* + * Low-level library for db.idx. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +/* +Brief summary of db.idx structure: +- This file seems to have 12-bytes header +- Indices consist of multiple binary search trees +- The offset addresses to the root nodes are specified in db.dic +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "ip3db.h" +#include "dic.h" + +typedef struct { + uint32_t size; + uint32_t unknown1; + uint32_t unknown2; +} header_t; + +typedef struct { + uint32_t left; + uint32_t right; + uint32_t height; + uint32_t leaf; +} node_t; + +typedef struct { + uint32_t dat_offset; + uint32_t next; +} tail_t; + +typedef struct { + uint32_t type; + union { + uint8_t byte; + uint16_t word; + uint32_t dword; + ucs2char_t* str; + } value; +} variant_t; + +static size_t idx_serialize_header(uint8_t *block, header_t *header, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &header->size, is_storing); + p += serialize_uint32be(p, &header->unknown1, is_storing); + p += serialize_uint32be(p, &header->unknown2, is_storing); + return sizeof(header_t); +} + +static size_t idx_serialize_node(uint8_t *block, node_t *node, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &node->left, 0); + p += serialize_uint32be(p, &node->right, 0); + p += serialize_uint32be(p, &node->height, 0); + p += serialize_uint32be(p, &node->leaf, 0); + return sizeof(node_t); +} + +static size_t idx_serialize_tail(uint8_t *block, tail_t* tail, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &tail->dat_offset, is_storing); + p += serialize_uint32be(p, &tail->next, is_storing); + return sizeof(tail_t); +} + +void variant_init(variant_t* var, int type) +{ + memset(var, 0, sizeof(*var)); + var->type = type; +} + +void variant_finish(variant_t* var) +{ + if (var->type == IP3DBVT_STRING) { + ucs2free(var->value.str); + } + variant_init(var, IP3DBVT_NONE); +} + +/** + * Prototype definition of a callback function for idx_walk. + * @param buffer The pointer to the index buffer. + * @param offset The offset address of the current node. + * @param node The information of the node. + * @param key The key value of the node. + * @param types The key types. + * @param level The current key level. + * @param flag + * @param instance The instance value. + */ +typedef int (*idx_walk_callback_t)( + uint8_t* buffer, + uint32_t offset, + node_t* node, + variant_t* key, + int* types, + int level, + int flag, + void *instance + ); + +void idx_walk( + uint8_t *buffer, + uint32_t offset, + int *types, + int level, + idx_walk_callback_t callback, + void *instance + ) +{ + node_t node; + variant_t key; + int type = types[level]; + uint8_t* p = buffer + offset; + + /* Read the node information. */ + p += idx_serialize_node(p, &node, 0); + + /* Descend to left children. */ + if (node.left) { + idx_walk(buffer, node.left, types, level, callback, instance); + } + + /* Read the key value. */ + variant_init(&key, type); + switch (type) { + case IP3DBVT_BYTE: + p += serialize_uint8(p, &key.value.byte, 0); + break; + case IP3DBVT_WORD: + p += serialize_uint16be(p, &key.value.word, 0); + break; + case IP3DBVT_DWORD: + p += serialize_uint32be(p, &key.value.dword, 0); + break; + case IP3DBVT_STRING: + p += serialize_ucs2be_string_var_alloc(p, &key.value.str) * sizeof(ucs2char_t); + break; + } + + /* Invoke the callback function. */ + if (callback && type) { + callback(buffer, offset, &node, &key, types, level, 1, instance); + } + + /* Descend to the next key level if necessary. */ + if (level+1 < IP3DBIDX_MAX_KEYLEVEL && types[level+1]) { + idx_walk(buffer, node.leaf, types, level+1, callback, instance); + } + + /* Invoke the callback function. */ + if (callback && type) { + callback(buffer, offset, &node, &key, types, level, 0, instance); + } + + /* Descend to right children. */ + if (node.right) { + idx_walk(buffer, node.right, types, level, callback, instance); + } +} + +static void fprinti(FILE *fp, int n) +{ + while (n--) fputc(' ', fp); +} + +int idx_walkcb_dump( + uint8_t* buffer, + uint32_t offset, + node_t* node, + variant_t* key, + int* types, + int level, + int flag, + void *instance + ) +{ + FILE *fp = (FILE*)instance; + int indent = 2 * (level + 1); + + if (flag) { + fprinti(fp, indent); + fprintf(fp, "NODE (0x%08X) = {\n", offset); + fprinti(fp, indent); + fprintf(fp, " left: 0x%08X\n", node->left); + fprinti(fp, indent); + fprintf(fp, " right: 0x%08X\n", node->right); + fprinti(fp, indent); + fprintf(fp, " data: 0x%08X\n", node->leaf); + + fprinti(fp, indent); + fprintf(fp, " key: "); + switch (key->type) { + case IP3DBVT_BYTE: + fprintf(fp, "0x%02X", key->value.byte); + break; + case IP3DBVT_WORD: + fprintf(fp, "0x%04X", key->value.word); + break; + case IP3DBVT_DWORD: + fprintf(fp, "0x%08X", key->value.dword); + break; + case IP3DBVT_STRING: + fprints(fp, "%s", key->value.str); + break; + } + fprintf(fp, "\n"); + + if (IP3DBIDX_MAX_KEYLEVEL <= level+1 || !types[level+1]) { + tail_t tail; + + memset(&tail, 0, sizeof(tail)); + tail.next = node->leaf; + + fprinti(fp, indent); + fprintf(fp, " dat_offset: [\n", node->left); + while (tail.next) { + uint8_t *p = buffer + tail.next; + idx_serialize_tail(p, &tail, 0); + fprinti(fp, indent); + fprintf(fp, " 0x%08X\n", tail.dat_offset); + } + fprinti(fp, indent); + fprintf(fp, " ]\n", node->left); + } + } else { + fprinti(fp, indent); + fprintf(fp, "}\n"); + } + + return 0; +} + +int idx_dump(FILE *fpo, ip3db_t* db) +{ + int i; + header_t header; + + fprintf(fpo, "===== db.idx =====\n"); + + /* Dump the header. */ + idx_serialize_header(db->idx_buffer, &header, 0); + fprintf(fpo, "size: 0x%08X\n", header.size); + fprintf(fpo, "unknown1: 0x%08X\n", header.unknown1); + fprintf(fpo, "unknown2: 0x%08X\n", header.unknown2); + + /* Dump the binary search trees. */ + for (i = 0;i < IP3DBIDX_LAST;++i) { + ip3db_index_param_t* index_param = ip3db_get_indexparam(i); + uint32_t idx_root = dic_get_idxroot(db->dic_buffer, i); + fprintf(fpo, "[%s]\n", index_param->name); + idx_walk(db->idx_buffer, idx_root, index_param->types, 0, idx_walkcb_dump, (void*)stdout); + } + + fprintf(fpo, "\n"); + return 0; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/idx.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,28 @@ +/* + * Low-level library for db.idx. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifndef __IP3DB_IDX_H__ +#define __IP3DB_IDX_H__ + + +#endif/*__IP3DB_IDX_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/idx.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,127 @@ +/* + * Media database reader/writer for iriver E10. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> + +#include "util.h" +#include "dat.h" +#include "ip3db.h" + +static ip3db_index_param_t ip3db_index_param[IP3DBIDX_LAST] = { + {"Music.Title", 0x0086, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.Rating", 0x00F8, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.TrackNumber", 0x0152, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.ChangedFlag", 0x022C, {IP3DBVT_BYTE, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.ClusM", 0x027A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.UID", 0x031C, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.Genre-Artist-Title", 0x0352, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_STRING}}, + {"Music.Artist-Album-TrackNumber", 0x0384, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_WORD}}, + {"Music.Artist-TrackNumber", 0x03C2, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, + {"Music.Artist-Title", 0x03F4, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, + {"Music.Genre-Title", 0x041A, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, + {"Music.Album-TrackNumber", 0x043E, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, + {"Object.UID", 0x099A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.FileType", 0x09F0, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.ObjectName", 0x0A0E, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.FileType-ParentUid-Properties", 0x0ACE, {IP3DBVT_WORD, IP3DBVT_DWORD, IP3DBVT_BYTE}}, +}; + +ip3db_index_param_t* ip3db_get_indexparam(int field) +{ + return &ip3db_index_param[field]; +} + +void ip3db_init(ip3db_t* db) +{ + memset(db, 0, sizeof(*db)); +} + +void ip3db_finish(ip3db_t* db) +{ + free(db->dat_buffer); + free(db->dic_buffer); + free(db->idx_buffer); + ip3db_init(db); +} + +static const ucs2char_t g_ucs2cs_datdb[] = {'d','b','.','d','a','t',0}; +static const ucs2char_t g_ucs2cs_dicdb[] = {'d','b','.','d','i','c',0}; +static const ucs2char_t g_ucs2cs_idxdb[] = {'d','b','.','i','d','x',0}; + +result_t ip3db_load(ip3db_t* db, const ucs2char_t* path) +{ + FILE *fp = 0; + ucs2char_t filename[MAX_PATH]; + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_datdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->dat_buffer, &db->dat_size); + fclose(fp); + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_dicdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->dic_buffer, &db->dic_size); + fclose(fp); + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_idxdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->idx_buffer, &db->idx_size); + fclose(fp); + + return 0; +} + +result_t ip3db_dump(FILE *fpo, ip3db_t* db) +{ + /* Dump db.dat */ + dat_t* dat = dat_new(); + dat_serialize(db->dat_buffer, dat, 0); + dat_dump(fpo, dat); + dat_finish(dat); + + /* Dump db.idx */ + idx_dump(fpo, db); + return 0; +} \ No newline at end of file Property changes on: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,88 @@ +/* + * Media database reader/writer for iriver E10. + * + * Copyright (c) 2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifndef __IP3DB_IP3DB_H__ +#define __IP3DB_IP3DB_H__ + +enum { + IP3DBIDX_MUSIC_TITLE, + IP3DBIDX_MUSIC_RATING, + IP3DBIDX_MUSIC_TRACKNUMBER, + IP3DBIDX_MUSIC_CHANGEDFLAG, + IP3DBIDX_MUSIC_CLUSM, + IP3DBIDX_MUSIC_UID, + IP3DBIDX_MUSIC_GENRE_ARTIST_TITLE, + IP3DBIDX_MUSIC_ARTIST_ALBUM_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TITLE, + IP3DBIDX_MUSIC_GENRE_TITLE, + IP3DBIDX_MUSIC_ALBUM_TRACKNUMBER, + IP3DBIDX_OBJECT_UID, + IP3DBIDX_OBJECT_FILETYPE, + IP3DBIDX_OBJECT_OBJECTNAME, + IP3DBIDX_OBJECT_FILETYPE_PARENTUID_PROP, + IP3DBIDX_LAST +}; + +enum { + IP3DBIDX_MAX_KEYLEVEL = 3, +}; + +enum { + IP3DBVT_NONE, + IP3DBVT_BYTE, + IP3DBVT_WORD, + IP3DBVT_DWORD, + IP3DBVT_STRING, +}; + + +typedef struct { + const char* name; + uint32_t dic_offset; + int types[IP3DBIDX_MAX_KEYLEVEL]; +} ip3db_index_param_t; + +struct tag_dat_t; typedef struct tag_dat_t dat_t; + +typedef struct { + uint8_t* dat_buffer; + long dat_size; + uint8_t* dic_buffer; + long dic_size; + uint8_t* idx_buffer; + long idx_size; + + dat_t* dat; +} ip3db_t; + +int idx_dump(FILE *fpo, ip3db_t* db); + +ip3db_index_param_t* ip3db_get_indexparam(int field); + +void ip3db_init(ip3db_t* db); +void ip3db_finish(ip3db_t* db); +result_t ip3db_load(ip3db_t* db, const ucs2char_t* path); +result_t ip3db_dump(FILE *fpo, ip3db_t* db); + +#endif /*_IP3DB_IP3DB_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,243 @@ +<?xml version="1.0" encoding="shift_jis"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="pmp_iriverplus3" + ProjectGUID="{C74FE9C9-B5C4-438A-B157-9BCB6C8A7546}" + RootNamespace="pmp_iriverplus3" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(SolutionDir)include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS3_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="$(SolutionDir)include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS3_EXPORTS" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\dat.c" + > + </File> + <File + RelativePath=".\dic.c" + > + </File> + <File + RelativePath=".\idx.c" + > + </File> + <File + RelativePath=".\ip3db.c" + > + </File> + <File + RelativePath=".\serialize.c" + > + </File> + <File + RelativePath=".\util.c" + > + </File> + </Filter> + <Filter + Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\dat.h" + > + </File> + <File + RelativePath=".\dic.h" + > + </File> + <File + RelativePath=".\idx.h" + > + </File> + <File + RelativePath=".\ip3db.h" + > + </File> + <File + RelativePath=".\serialize.h" + > + </File> + <File + RelativePath=".\util.h" + > + </File> + </Filter> + <Filter + Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/pmplib/lib/pmp_iriverplus3/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,155 @@ +/* + * Data serializer (with byte-order consideration). + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <memory.h> +#include <stddef.h> +#include <ucs2char.h> + +#include "serialize.h" + +size_t serialize_uint8(uint8_t* buffer, uint8_t* value, int is_storing) +{ + if (is_storing) { + *buffer = *value; + } else { + *value = *buffer; + } + return 1; +} + +size_t serialize_uint8_array(uint8_t* buffer, uint8_t* array, size_t length, int is_storing) +{ + size_t i; + for (i = 0;i < length;i++) { + buffer += serialize_uint8(buffer, array++, is_storing); + } + return length; +} + +size_t serialize_uint16be(uint8_t* buffer, uint16_t* value, int is_storing) +{ + if (is_storing) { + buffer[0] = (uint8_t)(*value >> 8); + buffer[1] = (uint8_t)(*value & 0xFF); + } else { + *value = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1]; + } + return sizeof(uint16_t); +} + +size_t serialize_uint16le(uint8_t* buffer, uint16_t* value, int is_storing) +{ + if (is_storing) { + buffer[1] = (uint8_t)(*value >> 8); + buffer[0] = (uint8_t)(*value & 0xFF); + } else { + *value = (uint16_t)buffer[1] << 8 | (uint16_t)buffer[0]; + } + return sizeof(uint16_t); +} + +size_t serialize_uint32be(uint8_t* buffer, uint32_t* value, int is_storing) +{ + if (is_storing) { + buffer[0] = (uint8_t)(*value >> 24); + buffer[1] = (uint8_t)(*value >> 16); + buffer[2] = (uint8_t)(*value >> 8); + buffer[3] = (uint8_t)(*value & 0xFF); + } else { + *value = + (uint32_t)buffer[0] << 24 | (uint32_t)buffer[1] << 16 | + (uint32_t)buffer[2] << 8 | (uint32_t)buffer[3]; + } + return sizeof(uint32_t); +} + +size_t serialize_uint32le(uint8_t* buffer, uint32_t* value, int is_storing) +{ + if (is_storing) { + buffer[3] = (uint8_t)(*value >> 24); + buffer[2] = (uint8_t)(*value >> 16); + buffer[1] = (uint8_t)(*value >> 8); + buffer[0] = (uint8_t)(*value & 0xFF); + } else { + *value = + (uint32_t)buffer[3] << 24 | (uint32_t)buffer[2] << 16 | + (uint32_t)buffer[1] << 8 | (uint32_t)buffer[0]; + } + return sizeof(uint32_t); +} + +size_t serialize_ucs2be(uint8_t* buffer, ucs2char_t* value, int is_storing) +{ + serialize_uint16be(buffer, (uint16_t*)value, is_storing); + return sizeof(ucs2char_t); +} + +size_t serialize_ucs2be_string_fixed(uint8_t* buffer, ucs2char_t* str, size_t length, int is_storing) +{ + size_t i; + for (i = 0;i < length;i++) { + serialize_ucs2be(buffer, str, is_storing); + buffer += sizeof(ucs2char_t); + ++str; + } + return length; +} + +size_t serialize_ucs2be_string_var(uint8_t* buffer, ucs2char_t* str, int is_storing) +{ + size_t length = 0; + while (serialize_ucs2be(buffer, str, is_storing), *str) { + ++length; + ++str; + buffer += sizeof(ucs2char_t); + } + return length; +} + +size_t serialize_ucs2be_string_var_alloc(uint8_t* buffer, ucs2char_t** str) +{ + ucs2char_t c; + size_t length = 0; + uint8_t* p = buffer; + + /* Measure the length of the string. */ + while (serialize_ucs2be(p, &c, 0), c) { + ++length; + p += sizeof(ucs2char_t); + } + + /* Allocate a string buffer. */ + ucs2free(*str); + *str = ucs2malloc(sizeof(ucs2char_t) * (length+1)); + memset(*str, 0, sizeof(ucs2char_t) * (length+1)); + + /* Read the string. */ + serialize_ucs2be_string_fixed(buffer, *str, length, 0); + + return length; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/serialize.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/serialize.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,38 @@ +/* + * Data serializer (with byte-order consideration). + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifndef __IP2DB_SERIALIZE_H__ +#define __IP2DB_SERIALIZE_H__ + +size_t serialize_uint8(uint8_t* buffer, uint8_t* value, int is_storing); +size_t serialize_uint8_array(uint8_t* buffer, uint8_t* array, size_t length, int is_storing); +size_t serialize_uint16le(uint8_t* buffer, uint16_t* value, int is_storing); +size_t serialize_uint32le(uint8_t* buffer, uint32_t* value, int is_storing); +size_t serialize_uint16be(uint8_t* buffer, uint16_t* value, int is_storing); +size_t serialize_uint32be(uint8_t* buffer, uint32_t* value, int is_storing); +size_t serialize_ucs2be(uint8_t* buffer, ucs2char_t* value, int is_storing); +size_t serialize_ucs2be_string_fixed(uint8_t* buffer, ucs2char_t* str, size_t length, int is_storing); +size_t serialize_ucs2be_string_var(uint8_t* buffer, ucs2char_t* str, int is_storing); +size_t serialize_ucs2be_string_var_alloc(uint8_t* buffer, ucs2char_t** str); + +#endif/*__IP2DB_SERIALIZE_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/serialize.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,150 @@ +/* + * Miscellaneous utilities. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <malloc.h> + +#include "util.h" + +int is_all_value(uint8_t* array, size_t size, uint8_t value) +{ + size_t i; + for (i = 0;i < size;i++) { + if (array[0] != value) { + return 0; + } + } + return 1; +} + +void fprints(FILE *fp, const char *format, const ucs2char_t* value) +{ + fprints_fixed(fp, format, value, ucs2len(value)); +} + +void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length) +{ + char *mbs = NULL; + ucs2char_t* tmp = alloca(sizeof(ucs2char_t) * (length+1)); + memset(tmp, 0, sizeof(ucs2char_t) * (length+1)); + ucs2ncpy(tmp, value, length); + mbs = ucs2dupmbs(tmp); + if (mbs) { + fprintf(fp, format, mbs); + ucs2free(mbs); + } +} + +void prints_fixed(FILE *fp, const ucs2char_t* value, size_t length) +{ + size_t i; + + for (i = 0;i < length;++i) { + if (value[i]) { + char mbs[8]; + memset(mbs, 0, sizeof(mbs)); + ucs2tombs(mbs, sizeof(mbs), &value[i], 1); + fprintf(fp, mbs); + } else { + fprintf(fp, " "); + } + } +} + +void fprintt(FILE *fp, const char *format, uint32_t value) +{ + static time_t basetime = 0; /* Basetime (static variable). */ + time_t timer = 0; + + /* Initialize basetime (Sat Jan 01 00:00:00 2000) for the first time. */ + if (basetime == 0) { + struct tm bt; + memset(&bt, 0, sizeof(bt)); + bt.tm_year = 2000 - 1900; + bt.tm_mon = 1 - 1; + bt.tm_mday = 1; + bt.tm_hour = 0; + bt.tm_min = 0; + bt.tm_sec = 0; + basetime = mktime(&bt); + } + + timer = basetime + (time_t)value; + fprintf(fp, format, asctime(gmtime(&timer))); +} + +void print_keystr(FILE *fp, const ucs2char_t* value, size_t length) +{ + size_t i; + + for (i = 0;i < length;++i) { + if (value[i] != 0xFFFF) { + break; + } + } + if (i < length) { + fprintf(fp, "\""); + prints_fixed(fp, value, length); + fprintf(fp, "\""); + } else { + fprintf(fp, "LAST"); + } +} + +void print_next(FILE *fp, const uint32_t value, uint8_t height) +{ + fprintf(fp, "%s%d", (height > 0 ? "@" : ""), value); +} + +int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size) +{ + uint8_t* buffer = NULL; + long size = 0; + + /* Obtain the stream size. */ + if (fseek(fp, 0, SEEK_END) != 0) { + return 1; + } + if ((size = ftell(fp)) == -1) { + return 1; + } + if (fseek(fp, 0, SEEK_SET) != 0) { + return 1; + } + + /* */ + buffer = (uint8_t*)malloc(size); + + fread(buffer, 1, size, fp); + + *ptr_buffer = buffer; + *ptr_size = size; + return 0; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/util.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/util.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/util.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,38 @@ +/* + * Miscellaneous utilities. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifndef __IP3DB_UTIL_H__ +#define __IP3DB_UTIL_H__ + +int is_all_value(uint8_t* array, size_t size, uint8_t value); + +void fprints(FILE *fp, const char *format, const ucs2char_t* value); +void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length); +void prints_fixed(FILE *fp, const ucs2char_t* value, size_t length); +void fprintt(FILE *fp, const char *format, uint32_t value); +void print_keystr(FILE *fp, const ucs2char_t* value, size_t length); +void print_next(FILE *fp, const uint32_t value, uint8_t height); + +int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size); + +#endif/*__IP3DB_UTIL_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/util.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/pmp.sln =================================================================== --- trunk/pmplib/pmp.sln 2006-12-24 01:56:05 UTC (rev 193) +++ trunk/pmplib/pmp.sln 2006-12-24 02:42:41 UTC (rev 194) @@ -9,63 +9,70 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmi", "lib\gmi\gmi.vcproj", "{3575EFC2-9051-467A-BEB4-E71E2F8664D7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp", "lib\pmp\pmp.vcproj", "{8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A}" ProjectSection(ProjectDependencies) = postProject + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_irivnavi", "lib\pmp_irivnavi\pmp_irivnavi.vcproj", "{2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_iriverplus2", "lib\pmp_iriverplus2\pmp_iriverplus2.vcproj", "{E393575C-6B10-43BD-B2C0-63C5040A49F7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playlist", "lib\playlist\playlist.vcproj", "{3419FA86-F518-4D3B-94C6-B05436439102}" ProjectSection(ProjectDependencies) = postProject + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_cui", "frontend\easypmp\cui\easypmp_cui.vcproj", "{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} + {544769C2-6989-452F-B626-E442CAC6553B} = {544769C2-6989-452F-B626-E442CAC6553B} + {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} + {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {544769C2-6989-452F-B626-E442CAC6553B} = {544769C2-6989-452F-B626-E442CAC6553B} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_win32gui", "frontend\easypmp\win32gui\easypmp_win32gui.vcproj", "{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} + {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} + {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_portalplayer1", "lib\pmp_portalplayer1\pmp_portalplayer1.vcproj", "{544769C2-6989-452F-B626-E442CAC6553B}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_iriverplus3", "lib\pmp_iriverplus3\pmp_iriverplus3.vcproj", "{C74FE9C9-B5C4-438A-B157-9BCB6C8A7546}" + ProjectSection(ProjectDependencies) = postProject + {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1... [truncated message content] |
From: <ny...@us...> - 2006-12-24 01:56:05
|
Revision: 193 http://svn.sourceforge.net/pmplib/?rev=193&view=rev Author: nyaochi Date: 2006-12-23 17:56:05 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Make the source compatible with Win32 (MSVC): - Win32 does not have TTY support. Introduced HAVE_TTY but I haven't changed configure.in yet. - MSVC does not support array definitions with variable length: char hoge[strlen(str)+1]; must be char *hoge = alloca(sizeof(*str) + (strlen(str)+1)); Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-12-24 01:35:06 UTC (rev 192) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-12-24 01:56:05 UTC (rev 193) @@ -114,14 +114,16 @@ */ void display_init() { +#ifdef HAVE_TTY int i; for(i = 0; i <= POSSIBLE_TTYS; ++i) fd_is_tty[i] = isatty(i); -#if CAN_GET_WIN_SIZE +#if CAN_GET_WIN_SIZE signal(SIGWINCH,window_size_changed); window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ +#endif/*HAVE_TTY*/ } /** @@ -160,6 +162,9 @@ void display_line(FILE *fp, const ucs2char_t* const line, unsigned int min_width) { + unsigned int length = ucs2len(line); + const ucs2char_t* line_to_print; + int writing_to_tty; /* Check if writing to a terminal. If so, clear the current line. */ int fd = fileno(fp); @@ -170,9 +175,6 @@ writing_to_tty = 0; } - unsigned int length = ucs2len(line); - const ucs2char_t* line_to_print; - if(!writing_to_tty) { /* Write the whole line to the file, add \n. */ fprints(fp, "%s\r\n", line); @@ -187,8 +189,7 @@ /* Length of string we actually will display: */ const size_t trunc_length = MIN(max_trunc_length, length); - ucs2char_t truncated_line[trunc_length+1]; - truncated_line[trunc_length]=0; + ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); ucs2ncpy(truncated_line, line, trunc_length); fprints(fp, "%s\r", truncated_line); } @@ -217,9 +218,9 @@ // Numeric part, plus associated punctuation const int prefix_length = 16; - char fmt[prefix_length + 1]; + char *fmt = alloca(sizeof(char) * prefix_length + 1); - ucs2char_t line[ucs2len(msg) + prefix_length + 1]; + ucs2char_t *line = alloca(sizeof(ucs2char_t) * (ucs2len(msg) + prefix_length + 1)); ucs2char_t *fmt_ucs2; // Build the numeric part... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 01:35:06
|
Revision: 192 http://svn.sourceforge.net/pmplib/?rev=192&view=rev Author: nyaochi Date: 2006-12-23 17:35:06 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Upgrade the Win32 build system to MS Visual Studio 2005. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj trunk/pmplib/lib/filepath/filepath.vcproj trunk/pmplib/lib/gmi/gmi.vcproj trunk/pmplib/lib/playlist/playlist.vcproj trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj trunk/pmplib/lib/ucs2/ucs2.vcproj trunk/pmplib/pmp.sln Modified: trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,110 +1,174 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="easypmp_cui" ProjectGUID="{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="1" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/easypmp_cui.exe" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/easypmp_cui.pdb" SubSystem="1" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="1" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="4" + RuntimeLibrary="0" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/easypmp_cui.exe" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -113,59 +177,75 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\device.c"> + RelativePath=".\device.c" + > </File> <File - RelativePath=".\getopt.c"> + RelativePath=".\getopt.c" + > </File> <File - RelativePath=".\getopt1.c"> + RelativePath=".\getopt1.c" + > </File> <File - RelativePath=".\main.c"> + RelativePath=".\main.c" + > </File> <File - RelativePath=".\option.c"> + RelativePath=".\option.c" + > </File> <File - RelativePath=".\util.c"> + RelativePath=".\util.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\getopt.h"> + RelativePath=".\getopt.h" + > </File> <File - RelativePath=".\option.h"> + RelativePath=".\option.h" + > </File> <File - RelativePath=".\util.h"> + RelativePath=".\util.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> <Filter Name="common" - Filter=""> + > <File - RelativePath="..\common\database.c"> + RelativePath="..\common\database.c" + > </File> <File - RelativePath="..\common\easypmp.h"> + RelativePath="..\common\easypmp.h" + > </File> <File - RelativePath="..\common\enumerate.c"> + RelativePath="..\common\enumerate.c" + > </File> <File - RelativePath="..\common\playlist.c"> + RelativePath="..\common\playlist.c" + > </File> </Filter> </Files> Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,130 +1,194 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="easypmp_win32gui" - ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}"> + ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="1" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="1"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="false" + TargetEnvironment="1" + GenerateStublessProxies="true" + TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" + HeaderFileName="easypmp_win32gui.h" + DLLDataFileName="" + InterfaceIdentifierFileName="easypmp_win32gui_i.c" + ProxyFileName="easypmp_win32gui_p.c" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;_DEBUG;USE_PCH" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - DebugInformationFormat="4"/> + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + AdditionalIncludeDirectories="$(IntDir)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies="version.lib imagehlp.lib" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool" - PreprocessorDefinitions="_DEBUG" - MkTypLibCompatible="FALSE" - TargetEnvironment="1" - GenerateStublessProxies="TRUE" - TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" - HeaderFileName="easypmp_win32gui.h" - DLLDataFileName="" - InterfaceIdentifierFileName="easypmp_win32gui_i.c" - ProxyFileName="easypmp_win32gui_p.c"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="1" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="1"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="$(SolutionDir)include,..\common" - PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;USE_PCH" - ExceptionHandling="FALSE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="0"/> + Name="VCPreBuildEventTool" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCCustomBuildTool" + /> <Tool - Name="VCLinkerTool" - AdditionalDependencies="version.lib imagehlp.lib" - LinkIncremental="1" - SubSystem="2" - TargetMachine="1"/> + Name="VCXMLDataGeneratorTool" + /> <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" - MkTypLibCompatible="FALSE" + MkTypLibCompatible="false" TargetEnvironment="1" - GenerateStublessProxies="TRUE" + GenerateStublessProxies="true" TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" HeaderFileName="easypmp_win32gui.h" DLLDataFileName="" InterfaceIdentifierFileName="easypmp_win32gui_i.c" - ProxyFileName="easypmp_win32gui_p.c"/> + ProxyFileName="easypmp_win32gui_p.c" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="$(SolutionDir)include,..\common" + PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;USE_PCH" + ExceptionHandling="0" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="0" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool - Name="VCPreLinkEventTool"/> - <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" - AdditionalIncludeDirectories="$(IntDir)"/> + AdditionalIncludeDirectories="$(IntDir)" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCPreLinkEventTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCLinkerTool" + AdditionalDependencies="version.lib imagehlp.lib" + LinkIncremental="1" + SubSystem="2" + TargetMachine="1" + /> <Tool - Name="VCWebDeploymentTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCManagedWrapperGeneratorTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -132,98 +196,144 @@ <Files> <Filter Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" + > <File - RelativePath=".\ejectdevice_win32.c"> + RelativePath=".\ejectdevice_win32.c" + > </File> <File - RelativePath=".\stdafx.cpp"> + RelativePath=".\stdafx.cpp" + > <FileConfiguration - Name="Debug|Win32"> + Name="Debug|Win32" + > <Tool Name="VCCLCompilerTool" - UsePrecompiledHeader="1"/> + UsePrecompiledHeader="1" + /> </FileConfiguration> <FileConfiguration - Name="Release|Win32"> + Name="Release|Win32" + > <Tool Name="VCCLCompilerTool" - UsePrecompiledHeader="1"/> + UsePrecompiledHeader="1" + /> </FileConfiguration> </File> <File - RelativePath=".\winmain.cpp"> + RelativePath=".\winmain.cpp" + > </File> </Filter> <Filter Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc"> + Filter="h;hpp;hxx;hm;inl;inc" + > <File - RelativePath=".\ejectdevice.h"> + RelativePath=".\ejectdevice.h" + > </File> <File - RelativePath=".\maindlg.h"> + RelativePath=".\maindlg.h" + > </File> <File - RelativePath=".\preference.h"> + RelativePath=".\preference.h" + > </File> <File - RelativePath=".\processingdlg.h"> + RelativePath=".\processingdlg.h" + > </File> <File - RelativePath=".\progress_with_caption.h"> + RelativePath=".\progress_with_caption.h" + > </File> <File - RelativePath=".\resource.h"> + RelativePath=".\resource.h" + > </File> <File - RelativePath=".\stdafx.h"> + RelativePath=".\stdafx.h" + > </File> </Filter> <Filter Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest"> + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest" + > <File - RelativePath=".\res\checkmark.ico"> + RelativePath=".\res\checkmark.ico" + > </File> <File - RelativePath=".\res\easypmp_win32gui.exe.manifest"> + RelativePath=".\res\easypmp_win32gui.exe.manifest" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> </File> <File - RelativePath=".\res\easypmp_win32gui.ico"> + RelativePath=".\res\easypmp_win32gui.ico" + > </File> <File - RelativePath=".\easypmp_win32gui.rc"> + RelativePath=".\easypmp_win32gui.rc" + > </File> <File - RelativePath=".\res\icon1.ico"> + RelativePath=".\res\icon1.ico" + > </File> <File - RelativePath=".\res\processing.ico"> + RelativePath=".\res\processing.ico" + > </File> <File - RelativePath=".\res\queuing.ico"> + RelativePath=".\res\queuing.ico" + > </File> </Filter> <Filter - Name="common"> + Name="common" + > <File - RelativePath="..\common\database.c"> + RelativePath="..\common\database.c" + > </File> <File - RelativePath="..\common\easypmp.h"> + RelativePath="..\common\easypmp.h" + > </File> <File - RelativePath="..\common\enumerate.c"> + RelativePath="..\common\enumerate.c" + > </File> <File - RelativePath="..\common\playlist.c"> + RelativePath="..\common\playlist.c" + > </File> </Filter> </Files> <Globals> <Global Name="RESOURCE_FILE" - Value="easypmp_win32gui.rc"/> + Value="easypmp_win32gui.rc" + /> </Globals> </VisualStudioProject> Modified: trunk/pmplib/lib/filepath/filepath.vcproj =================================================================== --- trunk/pmplib/lib/filepath/filepath.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/filepath/filepath.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="filepath" ProjectGUID="{AA8DA82B-C209-4ABE-ABA1-22352962426D}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILEPATH_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/filepath.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/filepath.pdb" SubSystem="2" ImportLibrary="$(OutDir)/filepath.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILEPATH_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/filepath.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/filepath.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,23 +179,28 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\filepath_win32.c"> + RelativePath=".\filepath_win32.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\filepath.h"> + RelativePath="..\..\include\filepath.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/gmi/gmi.vcproj =================================================================== --- trunk/pmplib/lib/gmi/gmi.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/gmi/gmi.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,114 +1,178 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="gmi" ProjectGUID="{3575EFC2-9051-467A-BEB4-E71E2F8664D7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GMI_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\id3tag\win32\libid3tagd.lib .\contrib\id3tag\win32\zlibd.lib .\contrib\ogg\win32\ogg_static_d.lib .\contrib\vorbis\win32\vorbisfile_static_d.lib" OutputFile="$(OutDir)/gmi.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/gmi.pdb" SubSystem="2" ImportLibrary="$(OutDir)/gmi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GMI_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\id3tag\win32\libid3tag.lib .\contrib\id3tag\win32\zlib.lib .\contrib\ogg\win32\ogg_static.lib .\contrib\vorbis\win32\vorbisfile_static.lib" OutputFile="$(OutDir)/gmi.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/gmi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -117,35 +181,44 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\gmi.c"> + RelativePath=".\gmi.c" + > </File> <File - RelativePath=".\gmi_mp3.c"> + RelativePath=".\gmi_mp3.c" + > </File> <File - RelativePath=".\gmi_vorbis.c"> + RelativePath=".\gmi_vorbis.c" + > </File> <File - RelativePath=".\gmi_wav.c"> + RelativePath=".\gmi_wav.c" + > </File> <File - RelativePath=".\gmi_wma.c"> + RelativePath=".\gmi_wma.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\gmi.h"> + RelativePath="..\..\include\gmi.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/playlist/playlist.vcproj =================================================================== --- trunk/pmplib/lib/playlist/playlist.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/playlist/playlist.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,114 +1,178 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="playlist" ProjectGUID="{3419FA86-F518-4D3B-94C6-B05436439102}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,.\contrib\js" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLAYLIST_EXPORTS;XP_WIN;HAVE_JSAPI_H" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\js\win32\js32d.lib" OutputFile="$(OutDir)/playlist.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/playlist.pdb" SubSystem="2" ImportLibrary="$(OutDir)/playlist.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,.\contrib\js" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLAYLIST_EXPORTS;XP_WIN;HAVE_JSAPI_H" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\js\win32\js32.lib" OutputFile="$(OutDir)/playlist.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/playlist.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -117,32 +181,40 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\jspl.c"> + RelativePath=".\jspl.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\rw_m3u.c"> + RelativePath=".\rw_m3u.c" + > </File> <File - RelativePath=".\rw_pls.c"> + RelativePath=".\rw_pls.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\playlist.h"> + RelativePath="..\..\include\playlist.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp" ProjectGUID="{8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,29 +179,36 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\pmp.c"> + RelativePath=".\pmp.c" + > </File> <File - RelativePath=".\pmp_win32.c"> + RelativePath=".\pmp_win32.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\pmp.h"> + RelativePath="..\..\include\pmp.h" + > </File> <File - RelativePath="..\..\include\pmphelp.h"> + RelativePath="..\..\include\pmphelp.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp_iriverplus2" ProjectGUID="{E393575C-6B10-43BD-B2C0-63C5040A49F7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS2_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_iriverplus2.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp_iriverplus2.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp_iriverplus2.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS2_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_iriverplus2.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp_iriverplus2.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,68 +179,88 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\dat.c"> + RelativePath=".\dat.c" + > </File> <File - RelativePath=".\idx.c"> + RelativePath=".\idx.c" + > </File> <File - RelativePath=".\idx_descriptor.c"> + RelativePath=".\idx_descriptor.c" + > </File> <File - RelativePath=".\idx_exports.c"> + RelativePath=".\idx_exports.c" + > </File> <File - RelativePath=".\idx_header.c"> + RelativePath=".\idx_header.c" + > </File> <File - RelativePath=".\idx_leaf.c"> + RelativePath=".\idx_leaf.c" + > </File> <File - RelativePath=".\idx_node.c"> + RelativePath=".\idx_node.c" + > </File> <File - RelativePath=".\ip2db.c"> + RelativePath=".\ip2db.c" + > </File> <File - RelativePath=".\ip2db_dat.c"> + RelativePath=".\ip2db_dat.c" + > </File> <File - RelativePath=".\ip2db_idx.c"> + RelativePath=".\ip2db_idx.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\pmp_iriverplus2.c"> + RelativePath=".\pmp_iriverplus2.c" + > </File> <File - RelativePath=".\serialize.c"> + RelativePath=".\serialize.c" + > </File> <File - RelativePath=".\util.c"> + RelativePath=".\util.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\ip2db.h"> + RelativePath=".\ip2db.h" + > </File> <File - RelativePath=".\serialize.h"> + RelativePath=".\serialize.h" + > </File> <File - RelativePath=".\util.h"> + RelativePath=".\util.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp_irivnavi" ProjectGUID="{2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVNAVI_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_irivnavi.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp_irivnavi.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp_irivnavi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVNAVI_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_irivnavi.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp_irivnavi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,35 +179,44 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\irivnavi.c"> + RelativePath=".\irivnavi.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\pmp_irivnavi.c"> + RelativePath=".\pmp_irivnavi.c" + > </File> <File - RelativePath=".\serialize.c"> + RelativePath=".\serialize.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\irivnavi.h"> + RelativePath=".\irivnavi.h" + > </File> <File - RelativePath=".\serialize.h"> + RelativePath=".\serialize.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj =================================================================== ... [truncated message content] |
From: <ny...@us...> - 2006-12-16 02:49:13
|
Revision: 191 http://svn.sourceforge.net/pmplib/?rev=191&view=rev Author: nyaochi Date: 2006-12-15 18:49:11 -0800 (Fri, 15 Dec 2006) Log Message: ----------- New PMPlib forum at nyaochi.sakura.ne.jp Modified Paths: -------------- trunk/webpage/pmplib.xsl Modified: trunk/webpage/pmplib.xsl =================================================================== --- trunk/webpage/pmplib.xsl 2006-10-18 21:47:05 UTC (rev 190) +++ trunk/webpage/pmplib.xsl 2006-12-16 02:49:11 UTC (rev 191) @@ -300,7 +300,7 @@ </ul> </li> <li><a href="apidox/html/index.html">API Documentation</a></li> - <li><a href="http://sourceforge.net/forum/?group_id=157298">Forum</a></li> + <li><a href="http://nyaochi.sakura.ne.jp/pmplib/">Forum</a></li> <!--<li><a href="faq.html">FAQ</a></li>--> <li><a href="about.html">About</a></li> <li><a href="http://sourceforge.net/projects/pmplib/">Project Home</a></li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-10-18 21:47:14
|
Revision: 190 http://svn.sourceforge.net/pmplib/?rev=190&view=rev Author: sucknblow Date: 2006-10-18 14:47:05 -0700 (Wed, 18 Oct 2006) Log Message: ----------- Build on latest Debian. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/lib/filepath/Makefile.am trunk/pmplib/lib/filepath/rel2abs.h Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-10-18 21:47:05 UTC (rev 190) @@ -39,11 +39,13 @@ #endif/*HAVE_STRING_H*/ #include <os.h> -#include <systems.h> #include <stdio.h> #include <stdlib.h> #include <ucs2char.h> +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + #if CAN_GET_WIN_SIZE #include <sys/ioctl.h> #include <signal.h> @@ -163,9 +165,9 @@ int fd = fileno(fp); if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { clear_line(fp); - writing_to_tty = TRUE; + writing_to_tty = 1; } else { - writing_to_tty = FALSE; + writing_to_tty = 0; } unsigned int length = ucs2len(line); Modified: trunk/pmplib/lib/filepath/Makefile.am =================================================================== --- trunk/pmplib/lib/filepath/Makefile.am 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/lib/filepath/Makefile.am 2006-10-18 21:47:05 UTC (rev 190) @@ -5,6 +5,7 @@ libpmpfilepath_la_SOURCES = \ ../../include/filepath.h \ filepath_posix.c \ + rel2abs.h \ rel2abs.c libpmpfilepath_la_LDFLAGS = \ Modified: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/lib/filepath/rel2abs.h 2006-10-18 21:47:05 UTC (rev 190) @@ -25,12 +25,14 @@ #ifndef __REL2ABS_H__ #define __REL2ABS_H__ +#include <ucs2char.h> + /** * \addtogroup filepath * @{ */ -ucs2char_t *rel2abs(const ucs2char_t *path, +ucs2char_t* rel2abs(const ucs2char_t *path, const ucs2char_t *base, ucs2char_t *ucs2char_t, size_t size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-22 19:05:50
|
Revision: 189 Author: sucknblow Date: 2006-08-22 12:05:46 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=189&view=rev Log Message: ----------- Fix behaviour for working with other projects Modified Paths: -------------- trunk/scripts/emacs/pmp-emacs.el Modified: trunk/scripts/emacs/pmp-emacs.el =================================================================== --- trunk/scripts/emacs/pmp-emacs.el 2006-08-18 23:19:21 UTC (rev 188) +++ trunk/scripts/emacs/pmp-emacs.el 2006-08-22 19:05:46 UTC (rev 189) @@ -37,9 +37,9 @@ (with-temp-buffer ;; We can probably find the repo url in the first 300 chars (insert-file-contents entries t) - (search-forward "<entry" nil nil) - (search-forward "<entry" nil nil) - (search-backward "sourceforge.net/svnroot/pmplib" nil nil)))))) + (search-forward "<entry" nil t) + (search-forward "<entry" nil t) + (search-backward "sourceforge.net/svnroot/pmplib" nil t)))))) ;; Pick a suitable dictionary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-18 23:19:25
|
Revision: 188 Author: sucknblow Date: 2006-08-18 16:19:21 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=188&view=rev Log Message: ----------- Fix typo. Set properties. Modified Paths: -------------- trunk/pmplib/lib/filepath/rel2abs.h Property Changed: ---------------- trunk/pmplib/lib/filepath/rel2abs.h Modified: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h 2006-08-18 23:08:34 UTC (rev 187) +++ trunk/pmplib/lib/filepath/rel2abs.h 2006-08-18 23:19:21 UTC (rev 188) @@ -20,7 +20,7 @@ * */ -/* $Id: util.h 183 2006-08-12 18:46:14Z sucknblow $ */ +/* $Id$ */ #ifndef __REL2ABS_H__ #define __REL2ABS_H__ @@ -36,7 +36,5 @@ size_t size); /** @} */ -#endif/*__UTIL_H__*/ +#endif/*__REL2ABS_H__*/ - - Property changes on: trunk/pmplib/lib/filepath/rel2abs.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-18 23:08:52
|
Revision: 187 Author: sucknblow Date: 2006-08-18 16:08:34 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=187&view=rev Log Message: ----------- API doc improvements: fix title in HTML output add rel2abs to the docs (needed a header file) fewer enum consts per line use a full stop on module names improve util.c docs document: path separator defines, more filepath stuff, rel2abs (incomplete, function looks broken to me) Modified Paths: -------------- trunk/pmplib/doc/Doxyfile trunk/pmplib/doc/pmplib-head.html trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/include/os.h trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/rel2abs.c trunk/pmplib/lib/gmi/Mainpage.dox trunk/pmplib/lib/ucs2/Mainpage.dox Added Paths: ----------- trunk/pmplib/lib/filepath/rel2abs.h Modified: trunk/pmplib/doc/Doxyfile =================================================================== --- trunk/pmplib/doc/Doxyfile 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/doc/Doxyfile 2006-08-18 23:08:34 UTC (rev 187) @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = PMPlib API +PROJECT_NAME = "PMPlib API" PROJECT_NUMBER = 0.12 OUTPUT_DIRECTORY = apidox CREATE_SUBDIRS = NO @@ -134,7 +134,7 @@ BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = YES -ENUM_VALUES_PER_LINE = 4 +ENUM_VALUES_PER_LINE = 3 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- Modified: trunk/pmplib/doc/pmplib-head.html =================================================================== --- trunk/pmplib/doc/pmplib-head.html 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/doc/pmplib-head.html 2006-08-18 23:08:34 UTC (rev 187) @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> -<title>pmplib: Cui</title> +<title>$title</title> <link href="../../common.css" rel="stylesheet" type="text/css"> <link href="pmplib-api.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-18 23:08:34 UTC (rev 187) @@ -22,10 +22,19 @@ /* $Id$ */ -#ifdef HAVE_CONFIG_H +/** + * @file + * Utility functions for the easypmp command line program (mostly + * display related). + * + * @addtogroup cui + * @{ + */ + +#ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ -#ifdef HAVE_STRING_H +#ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ @@ -42,48 +51,46 @@ #include "util.h" -/** - * \addtogroup cui - * @{ - */ - #if CAN_GET_WIN_SIZE /** - The number of characters that can be printed on a single line, - without causing a line wrap. Since the right-most column is - required for the cursor, this is one less than the actual terminal - width. - - Defaults to 79 on systems where we can't tell the width of the - terminal. -*/ + * The number of characters that can be printed on a single line, + * without causing a line wrap. Since the right-most column is + * required for the cursor, this is one less than the actual terminal + * width. + * + * Defaults to 79 on systems where we can't tell the width of the + * terminal. + */ static volatile unsigned short int window_width; #else static const unsigned short int window_width = 79; #endif -/** - The minimum width of the terminal we're willing to entertain. If the - terminal gets narrower than this width, we treat it as this width. - Note that it must be at least 2 to allow for one character and the - cursor. +/** + * The minimum width of the terminal we're willing to entertain. If + * the terminal gets narrower than this width, we treat it as this + * width. Note that it must be at least 2 to allow for one character + * and the cursor. */ static const int min_term_width = 6; +#define POSSIBLE_TTYS 2 /** - Flags to indicate whether stdin, stdout, and stderr are attached to a - terminal. These are used to determine whether we should check the - width of some progress lines before printing them. Initialised in - display_init. + * Flags to indicate whether stdin, stdout, and stderr are attached to + * a terminal. These are used to determine whether we should check + * the width of some progress lines before printing them. Initialised + * in display_init. */ -#define POSSIBLE_TTYS 2 static int fd_is_tty[POSSIBLE_TTYS+1]; #if CAN_GET_WIN_SIZE -/** - Hander for the "terminal window changed size" signal. -*/ + +/** + * Handler for the "terminal window changed size" signal. + * + * @param unused + */ void window_size_changed(int unused) { static struct winsize wsize; @@ -98,10 +105,15 @@ #endif/*CAN_GET_WIN_SIZE*/ +/** + * Determines whether stdin, stdout and stderr are associated with a + * TTY, and update fd_is_tty accordingly. Also sets up + * window_size_changed as a signal handler. + */ void display_init() { int i; - for(i = 0; i <= 2; ++i) + for(i = 0; i <= POSSIBLE_TTYS; ++i) fd_is_tty[i] = isatty(i); #if CAN_GET_WIN_SIZE @@ -110,9 +122,13 @@ #endif/*CAN_GET_WIN_SIZE*/ } -/** - Delete all text on the current line by overwriting it with spaces, - and write a \r to return the cursor to the start of the line. +/** + * Deletes all text on the current line by overwriting it with spaces. + * + * A 'blank line' is written to a given file pointer, @p fp. That is, + * a number of spaces equal to the current window width is written. + * This is followed by a carriage return character, to return the + * cursor to the start of the line. */ void clear_line(FILE *fp) { @@ -124,21 +140,23 @@ fprintf(fp, fmt, ""); } - -/** - Display as much of a UCS-2 encoded string as will fit on a single - line in the terminal, and returning the cursor to the start of the - line. If the terminal is less that the given minimum width, display - that minimum number of characters anyway, even if it means the text - will wrap onto the next line. - - If fp isn't associated with a terminal, just print the whole line. - - fp - FILE* to print on - line - the UCS-2 encoded string to display - min-width - minimum number of characters to print +/** + * Displays a UCS-2 string truncated for the terminal width. + * + * Displays as much of a UCS-2 encoded string as will fit on a single + * line in the terminal, and returning the cursor to the start of the + * line. If the terminal is less that the given minimum width, that + * minimum number of characters is displayed anyway, even if it means + * the text will wrap onto the next line. + * + * If @p fp isn't associated with a terminal, just print the whole line. + * + * @param fp FILE* to print on + * @param line the UCS-2 encoded string to display + * @param min_width minimum number of characters to print */ -void display_line(FILE *fp, const ucs2char_t* const line, unsigned int min_width) +void display_line(FILE *fp, const ucs2char_t* const line, + unsigned int min_width) { int writing_to_tty; /* Check if writing to a terminal. If so, clear the current line. */ @@ -174,19 +192,17 @@ } } -/** - Generic display method for progress messages consisting of a number - and a string. - - @param n number to be shown in the numeric part - @param msg message +/** + * Generic display method for progress messages consisting of a + * number and a string. + * + * @param fp + * @param n number to be shown in the numeric part + * @param msg message + * + * @return */ -int -easypmp_progress_num_str( - FILE *fp, - size_t n, - const ucs2char_t* msg - ) +int easypmp_progress_num_str(FILE *fp, size_t n, const ucs2char_t* msg) { /* A terminal must be of a certain width in order to usefully @@ -194,7 +210,7 @@ Specifically, it needs to be wide enough to display the number of files read. - display_line is used to trucate the line in this way. + display_line is used to truncate the line in this way. */ // Numeric part, plus associated punctuation @@ -222,7 +238,8 @@ fprints_fixed(fp, format, value, ucs2len(value)); } -void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length) +void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, + size_t length) { char *mbs = NULL; ucs2char_t* tmp = alloca(sizeof(ucs2char_t) * (length+1)); Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/include/os.h 2006-08-18 23:08:34 UTC (rev 187) @@ -1,5 +1,5 @@ /* - * Compatibility staff among operating systems and compilers. + * Compatibility stuff among operating systems and compilers. * * Copyright (c) 2005-2006 Nyaochi * @@ -55,7 +55,14 @@ #else +/** + * The native path separator for the current system, as a character. + */ #define PATHCHAR '/' + +/** + * The native path separator for the current system, as a string. + */ #define PATHSTR "/" #endif Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2006-08-18 23:08:34 UTC (rev 187) @@ -2,6 +2,7 @@ * File/path utility implemented with POSIX API. * * Copyright (c) 2005 Nyaochi + * Copyright (c) 2006 Martin Ellis <mar...@kd...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,10 +44,9 @@ #include <string.h> #include <sys/stat.h> -#include <filepath.h> +#include "filepath.h" +#include "rel2abs.h" -ucs2char_t *rel2abs(const ucs2char_t *path, const ucs2char_t *base, ucs2char_t *ucs2char_t, size_t size); - int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) { DIR *dirp = NULL; @@ -174,7 +174,6 @@ * terminator). * * @param path the path name to be modified. - * * @return a pointer to the last character in the new path. */ ucs2char_t* filepath_removeslash(ucs2char_t* path) @@ -187,6 +186,15 @@ return (path + length); } +/** + * Determines if a filename has a given extension (case-insensitive). + * + * + * @param filename file name to be checked. + * @param ext file name extension to check for. + * @return non-nil if the filename has the given extension, or nil + * otherwise. + */ int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext) { const ucs2char_t* p = search_extension((ucs2char_t*)filename); @@ -200,6 +208,10 @@ p++; ext++; } + /* ME: This seems redundant... won't "return (*p == *q);" do? + We only need to know whether we've reached the end of both + strings... + */ return (ucs2lower(*p) == ucs2lower(*ext)); } @@ -281,6 +293,15 @@ } } +/** + * Replace native path separators in a path with another character. + * + * The native path separators (i.e. '/' on POSIX-like systems) in the + * given @p path are replaced with the given character, @p c. The + * path is modified in place. + * @param path the path in which path separators are to be replaced. + * @param c the replacement character. + */ void filepath_replace_slash(ucs2char_t* path, ucs2char_t c) { while (*path) { @@ -315,6 +336,17 @@ } } +/** + * Tests whether a path name is relative. + * + * Checks whether the given @p path begins with a path separator + * character. If the path does begin with a path separator, then it + * is absolute and nil is returned. Otherwise the path is relative, + * and a non-nil value is returned. + * + * @param path the path to be tested for being relative. + * @return non-nil if the path name is relative, nil otherwise. + */ int filepath_is_relative(const ucs2char_t* path) { return (*path != PATHCHAR); @@ -330,11 +362,34 @@ return (rel2abs(relative, base, absolute, MAX_PATH) != NULL); } +/** + * Tests whether a path name has a given prefix. + * + * Tests whether the @p path name begins with the named @p root. If + * @p root names a directory with a trailing path separator, then this + * function is useful for checking whether a directory (or file) with + * the given @p path would be a sub-directory of (respectively, file + * located below) @p root. + * @param path the path name to be checked for a given prefix. + * @param root the prefix to check for. + * @return non-nil if the path name starts with the given @p root and + * nil otherwise. + */ int filepath_is_same_root(const ucs2char_t* path, const ucs2char_t* root) { return (ucs2ncmp(path, root, ucs2len(root)) == 0); } +/** + * Compares the modification times of two files. + * + * The modification times of @p file1 and @p file2 are compared, and + * the difference between them is returned. The result is: + * - < 0, if file2 was modified more recently than file1; + * - = 0, if the modification times are the same; + * - > 0, if file1 was modified more recently than file2. + * @return the difference in modification times between the two files. + */ int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2) { int ret = 0; @@ -375,6 +430,20 @@ return ret; } +/** + * Removes the named file. + * + * The given @p file name is converted to a multi-byte character + * string, which is used as an argument to the 'remove' function in + * the C library. Thus, if the @p file name refers to a file, then + * that file is unlinked. If it refers to a directory, and that + * directory is empty, then the directory is deleted. The value + * returned is the result of the calling remove, i.e. 0 on success, + * and -1 on error. The value of errno will be set in the case of an + * error. + * @param file the path name to be unlinked/deleted. + * @return 0 on success, -1 on error. + */ int filepath_removefile(const ucs2char_t* file) { int ret = 0; Modified: trunk/pmplib/lib/filepath/rel2abs.c =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.c 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/lib/filepath/rel2abs.c 2006-08-18 23:08:34 UTC (rev 187) @@ -1,6 +1,7 @@ /* * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved. * Copyright (c) 1999 Tama Communications Corporation. All rights reserved. + * Copyright (c) 2006 Martin Ellis <mar...@kd...>. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,6 +24,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + +/* + * @file + * + * @addtogroup filepath + * @{ + */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H_*/ @@ -32,22 +41,30 @@ #include <stdlib.h> #include <ucs2char.h> -/* - * rel2abs: convert an relative path name into absolute. +#include "rel2abs.h" + +/** + * Convert an relative path name into absolute path name. * - * i) path relative path - * i) base base directory (must be absolute path) - * o) result result buffer - * i) size size of result buffer - * r) != NULL: absolute path - * == NULL: error + * If the given @p path is already an absolute path, and the @p result + * buffer is large enough, then the absolute path is used as the + * @p result. + * + * On error, returns nil and sets errno to one of the following + * values: + * - EINVAL - the base directory was not an absolute path (did not + * begin with a '/'), or @p size was 0; + * - ERANGE - the @p size of the @p result buffer was too small. + * + * @param path relative path to convert. + * @param base base directory (must be absolute path). + * @param result result buffer. + * @param size size of result buffer. + * + * @return non-nil on success, nil if there was an error. */ -ucs2char_t * -rel2abs(path, base, result, size) - const ucs2char_t *path; - const ucs2char_t *base; - ucs2char_t *result; - const size_t size; +ucs2char_t* rel2abs(const ucs2char_t *path, const ucs2char_t *base, + ucs2char_t *result, const size_t size) { static const ucs2char_t ucs2cs_dot[] = {'.',0}; static const ucs2char_t ucs2cs_dot_dot[] = {'.','.',0}; @@ -62,6 +79,7 @@ int length; if (*path == '/') { + /* if the given path is absolute, just use that as the result */ if (ucs2len(path) >= size) goto erange; ucs2cpy(result, path); @@ -141,3 +159,4 @@ errno = ERANGE; return (NULL); } +/** @} */ Added: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h (rev 0) +++ trunk/pmplib/lib/filepath/rel2abs.h 2006-08-18 23:08:34 UTC (rev 187) @@ -0,0 +1,42 @@ +/* + * Relative to absolute path name conversion function (signature). + * + * Copyright (c) 2006 Martin Ellis <mar...@kd...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id: util.h 183 2006-08-12 18:46:14Z sucknblow $ */ + +#ifndef __REL2ABS_H__ +#define __REL2ABS_H__ + +/** + * \addtogroup filepath + * @{ + */ + +ucs2char_t *rel2abs(const ucs2char_t *path, + const ucs2char_t *base, + ucs2char_t *ucs2char_t, + size_t size); +/** @} */ + +#endif/*__UTIL_H__*/ + + + Modified: trunk/pmplib/lib/gmi/Mainpage.dox =================================================================== --- trunk/pmplib/lib/gmi/Mainpage.dox 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/lib/gmi/Mainpage.dox 2006-08-18 23:08:34 UTC (rev 187) @@ -1,5 +1,5 @@ /** - * \defgroup gmi Media file tag reading library (gmi) + * \defgroup gmi Media file tag reading library (gmi). * * This module provides functions for reading tags from media files. */ Modified: trunk/pmplib/lib/ucs2/Mainpage.dox =================================================================== --- trunk/pmplib/lib/ucs2/Mainpage.dox 2006-08-13 02:51:10 UTC (rev 186) +++ trunk/pmplib/lib/ucs2/Mainpage.dox 2006-08-18 23:08:34 UTC (rev 187) @@ -1,5 +1,5 @@ /** - * \defgroup ucs2 UCS-2 string library + * \defgroup ucs2 UCS-2 string library. * * This module provides functions for working with UCS-2 encoded * strings. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-13 02:51:18
|
Revision: 186 Author: sucknblow Date: 2006-08-12 19:51:10 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=186&view=rev Log Message: ----------- Start of APIdox for filepath. Modified Paths: -------------- trunk/pmplib/lib/filepath/filepath_posix.c Added Paths: ----------- trunk/pmplib/lib/filepath/Mainpage.dox Added: trunk/pmplib/lib/filepath/Mainpage.dox =================================================================== --- trunk/pmplib/lib/filepath/Mainpage.dox (rev 0) +++ trunk/pmplib/lib/filepath/Mainpage.dox 2006-08-13 02:51:10 UTC (rev 186) @@ -0,0 +1,5 @@ +/** + * @defgroup filepath File and path name library. + * Functions for working with file and path names with different path + * separators. + */ Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2006-08-13 01:26:12 UTC (rev 185) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2006-08-13 02:51:10 UTC (rev 186) @@ -22,6 +22,16 @@ /* $Id$ */ +/** + * @file + * + * Functions for working with file and path names with different path + * separators (POSIX implementation). + * + * @addtogroup filepath + * @{ + */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ @@ -103,6 +113,22 @@ return 0; } +/** + * Finds the file name extension in a native path name. + * + * Checks if the file name in the given @p path has a file name + * extension: that is, whether the part of the path after the last + * path separator contains a period ('.'). If the @p path has an + * extension a pointer to the first character after the last period + * is returned (or a pointer to the null terminator if there are no + * subsequent characters). If the file name has no extension, then + * null itself is returned. + * + * @param path the path name to be searched for an extension. + * + * @return a pointer to the file name extension, or NULL if none was + * found. + */ static ucs2char_t* search_extension(ucs2char_t* path) { ucs2char_t* p = ucs2rchr(path, PATHCHAR); @@ -115,6 +141,18 @@ return NULL; } +/** + * Adds the native path separator to a UCS-2 encoded path name. + * + * If the given @p path does not have a native path separator at the + * end, then one is added. The @p path is modified in place, and is + * assumed to have enough space allocated to it to add the extra + * character. + * + * @param path the path name to be modified. + * + * @return a pointer to the last character in the new path. + */ ucs2char_t* filepath_addslash(ucs2char_t* path) { size_t length = ucs2len(path); @@ -128,6 +166,17 @@ return (path + length); } +/** + * Removes the native path separator from a UCS-2 encoded path name. + * + * If the given @p path has a native path separator at then end, then + * it is removed (or more accurately, it is replaced with the null + * terminator). + * + * @param path the path name to be modified. + * + * @return a pointer to the last character in the new path. + */ ucs2char_t* filepath_removeslash(ucs2char_t* path) { size_t length = ucs2len(path)-1; @@ -335,6 +384,17 @@ return ret; } +/** + * Replaces all path separators with a backslash ('\') separator. + * + * Replaces all path separators in the given path with Windows-style + * path separators (back-slashes). On POSIX systems, this means + * converting forward slash ('/') path separators into backslashes. On + * Windows, this is a no-op. The @p path is modified in place. + * + * @param path the path to be converted. + * @return + */ int filepath_encode(ucs2char_t* path) { while (*path) { @@ -346,6 +406,17 @@ return 0; } +/** + * Replaces '\'-slashes in a path name with the native path separator. + * + * Replaces all Windows-style path separators (back-slashes) in the + * given path with the native path separator. On POSIX systems, the + * replacement character is a forward slash ('/'). On Windows, this + * is a no-op. The @p path is modified in place. + * + * @param path the path to be converted. + * @return + */ int filepath_decode(ucs2char_t* path) { while (*path) { @@ -356,3 +427,4 @@ } return 0; } +/**@}*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-13 01:26:18
|
Revision: 185 Author: sucknblow Date: 2006-08-12 18:26:12 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=185&view=rev Log Message: ----------- Emacs scripts for editing Doxygen comments. Modified Paths: -------------- trunk/scripts/emacs/pmp-emacs.el Added Paths: ----------- trunk/scripts/emacs/doxymacs.el trunk/scripts/emacs/xml-parse.el Added: trunk/scripts/emacs/doxymacs.el =================================================================== --- trunk/scripts/emacs/doxymacs.el (rev 0) +++ trunk/scripts/emacs/doxymacs.el 2006-08-13 01:26:12 UTC (rev 185) @@ -0,0 +1,1606 @@ +;;; -*-emacs-lisp-*- +;;; doxymacs.el --- ELisp package for making doxygen related stuff easier. +;; +;; +;; Copyright (C) 2001, 2002, 2003, 2005 Ryan T. Sammartino +;; +;; Author: Ryan T. Sammartino <ryan.sammartino at gmail dot com> +;; Kris Verbeeck <kris.verbeeck at advalvas dot be> +;; Created: 24/03/2001 +;; Version: 1.7.0 +;; Keywords: doxygen documentation +;; +;; This file is NOT part of GNU Emacs or XEmacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +;; +;; Doxymacs homepage: http://doxymacs.sourceforge.net/ +;; +;; $Id: doxymacs.el.in,v 1.23 2006/04/23 01:20:15 ryants Exp $ + +;; Commentary: +;; +;; Doxymacs depends on the following packages: +;; +;; - W3 http://www.cs.indiana.edu/usr/local/www/elisp/w3/docs.html +;; - tempo http://www.lysator.liu.se/~davidk/elisp/ +;; - libxml2 http://www.libxml.org/ +;; +;; Be sure these are properly configured and installed before proceeding. +;; +;; - Use the configure script to configure doxymacs: +;; +;; $ ./configure +;; $ make +;; $ make install +;; +;; Use ./configure --help for help on customising your configuration. +;; +;; If you get +;; +;; !! File error (("Cannot open load file" "url")) +;; +;; (or something similar) then set the variable EMACSLOADPATH before +;; doing make: +;; +;; $ EMACSLOADPATH=... make +;; +;; where ... is a colon separated list of directories to search for +;; packages. To byte compile with XEmacs, set the variable EMACS: +;; +;; $ EMACS=xemacs make +;; +;; If you would rather not byte compile the .el files at all, then do: +;; +;; $ make ELCFILES= +;; +;; - Customise the variable doxymacs-doxygen-dirs. +;; +;; - If your tags file is quite large (say, > 1 MB), consider setting +;; doxymacs-use-external-xml-parser to t and be sure to set +;; doxymacs-external-xml-parser-executable to the right value (the +;; default should usually be fine). A suitable program is +;; distributed along with this file in the directory doxymacs/c/. +;; With an 11 MB XML tag file, the internal process takes 20 minutes +;; on a PIII 800 with 1 GB of RAM, whereas the external process +;; takes 12 seconds. +;; +;; - Put (require 'doxymacs) in your .emacs +;; +;; - Invoke doxymacs-mode with M-x doxymacs-mode. To have doxymacs-mode +;; invoked automatically when in C/C++ mode, put +;; +;; (add-hook 'c-mode-common-hook 'doxymacs-mode) +;; +;; in your .emacs. +;; +;; - If you want Doxygen keywords fontified use M-x doxymacs-font-lock. +;; To do it automatically, add the following to your .emacs: +;; +;; (defun my-doxymacs-font-lock-hook () +;; (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode)) +;; (doxymacs-font-lock))) +;; (add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook) +;; +;; This will add the Doxygen keywords to c-mode and c++-mode only. +;; +;; - Default key bindings are: +;; - C-c d ? will look up documentation for the symbol under the point. +;; - C-c d r will rescan your Doxygen tags file. +;; - C-c d f will insert a Doxygen comment for the next function. +;; - C-c d i will insert a Doxygen comment for the current file. +;; - C-c d ; will insert a Doxygen comment for the current member. +;; - C-c d m will insert a blank multiline Doxygen comment. +;; - C-c d s will insert a blank singleline Doxygen comment. +;; - C-c d @ will insert grouping comments around the current region. +;; +;; Doxymacs has been tested on and works with: +;; - GNU Emacs 20.7.1, 21.1.1, 21.2.1, 21.2.92.1, 21.3, 21.4.1 +;; - XEmacs 21.1 (patch 14), 21.4 (patches 4-17) +;; +;; If you have success or failure with other version of {X}Emacs, please +;; let the authors know. + +;; Change log: +;; +;; 22/04/2006 - feature #1338245: Add tokens to filladapt to match +;; doxygen markup. +;; - version 1.7.0 +;; 04/06/2005 - version 1.6.0 +;; 14/04/2005 - Use doxymacs-url-exists-p to wrap the various ways of +;; checking whether a URL exists. +;; - Clean up symbol-near-point hack. +;; 13/04/2005 - feature request #868413: ability to customize the browser +;; doxymacs uses to display documentation. +;; 12/04/2005 - bug #990123: grouping comments do not work. +;; - add some missing doxygen keywords. +;; 01/04/2005 - patch #1024026: use new font-lock-add-keywords function if +;; available. +;; 31/03/2005 - patch #1102042: handle @param[in] etc. constructs +;; 25/01/2003 - remove hard coded version number from comments. +;; - add instructions to avoid byte compiling files. +;; - version 1.5.0 +;; 11/01/2003 - feature #665470: C++ style. +;; - fix bug #665099: missing @var fontification. +;; - fix bug #665372: @example not fontified properly. +;; - fix fontification for other keywords as well. +;; - new customisation variable doxymacs command-character +;; which allows for customisation of the character used +;; to introduce Doxygen commands independent of the +;; current style. +;; 05/01/2003 - autoconf-ise. +;; - version 1.4.0 +;; 09/12/2002 - turn off buffer modified flag for doxytags to avoid +;; prompting user for killing a modified buffer. +;; 08/12/2002 - move to association lists to support multiple Doxygen +;; generates. +;; 30/11/2002 - apply patch 636146: +;; - several FIXMEs fixed +;; - user-defined "void" types +;; - thanks to Georg Drenkhahn +;; 31/08/2002 - bug #601028 fixed... functions with blank lines in their +;; argument list confused doxymacs-extract-args-list +;; - version 1.3.2 +;; 09/05/2002 - fix issues compiling doxymacs_parser.c on Mac OS X. +;; - version 1.3.1 +;; 19/11/2001 - doxymacs has been tested on and works with XEmacs 21.4 +;; (patch 5) and GNU Emacs 21.1.1 +;; 04/11/2001 - add some documentation for default templates. +;; - implement grouping comments (C-c d @) +;; - version 1.3.0 +;; 30/09/2001 - doxymacs has been tested on and works with XEmacs 21.4 +;; (patch 4) +;; 15/09/2001 - bug #460396 fixed... wrong number of arguments for +;; doxymacs-parm-tempo-element in +;; doxymacs-Qt-function-comment-template +;; - version 1.2.1 +;; 26/08/2001 - feature request #454122 (single line member comments) done. +;; - feature request #454123 (key bindings description) done. +;; - clean up template code to make it easier to add new templates +;; and to catch bad settings. +;; - clean up documentation to be more standards conforming. +;; - version 1.2.0 +;; 23/08/2001 - fix bug #454563... missing @endlink in fontification, +;; fix @b, @em, @c, @p and @link fontification. +;; - make fontification regexps easier to read. +;; - version 1.1.4 +;; 07/07/2001 - make external XML parser work with libxml2. Now requires +;; version 2.3.4 or greater +;; - version 1.1.3 +;; 04/07/2001 - GNU Emacs doesn't understand ?: in regexps, so take them out +;; - version 1.1.2 +;; 20/06/2001 - fix bug #432837 missing @see keyword +;; - fix bug #432836 Font lock for @ingroup not correct +;; - version 1.1.1 +;; 12/06/2001 - add font lock keywords for Doxygen keywords +;; - version 1.1.0 +;; 06/06/2001 - fix bug #427660 (mouse selection problems). +;; - version 1.0.0 +;; 26/05/2001 - fix bug #427351 (thinks "void" is a parameter) and bug +;; #427350 (can't document constructors/destructors), and +;; generally made the whole doxymacs-find-next-func function +;; much more robust. Small update to default styles when +;; inserting functions that return "void" +;; - version 0.2.1 +;; 21/05/2001 - now able to optionally use an "external" XML parser to speed +;; things up. +;; - version 0.2.0 +;; 12/05/2001 - fix some bugs on GNU Emacs... tested and works with GNU +;; Emacs 20.7.1 +;; - version 0.1.2 +;; 09/05/2001 - change C-? to C-c d ?, since hitting DEL also triggers C-? +;; - update progress while parsing XML file +;; - version 0.1.1 +;; 07/05/2001 - minor mode thanks to Kris, and default key map. +;; - released as version 0.1.0 (Alpha) +;; 06/05/2001 - Now using tempo templates for the comments... also allow for +;; user defined templates. +;; 29/04/2001 - The doxytags.pl PERL script is no longer necessary, as we can +;; now parse the XML file that doxygen creates directly. +;; 22/04/2001 - Function documentation. +;; 18/04/2001 - Going with Kris' "new style" look up code. It's excellent. +;; - Load tags from URL. +;; 11/04/2001 - added ability to insert blank doxygen comments with either +;; Qt or JavaDoc style. +;; - also did "file" comments +;; 31/03/2001 - added ability to choose which symbol to look up if more than +;; one match +;; - slightly changed the format of the list that +;; doxymacs-get-matches returns +;; 28/03/2001 - added doxymacs to the "tools" customisation group. +;; - removed doxymacs-browser (just use user's default browser) +;; - minor formatting updates +;; 24/03/2001 - initial version. Pretty lame. Need some help. + +;; TODO: +;; +;; - better end-user documentation +;; - fix all FIXMEs (of course) +;; - other stuff? + +;; Front matter and variables + +(provide 'doxymacs) + +(require 'custom) +(require 'xml-parse) +(require 'url) +(require 'tempo) + +(defconst doxymacs-version "1.7.0" + "Doxymacs version number") + +(defun doxymacs-version () + "Report the current version of doxymacs in the minibuffer." + (interactive) + (message "Using doxymacs version %s" doxymacs-version)) + + +(defgroup doxymacs nil + "Find documentation created by Doxygen, and create Doxygen comments." + :group 'tools) + +(defcustom doxymacs-doxygen-dirs + nil + "List associating pathnames with Doxygen documentation. +Each item on the list is a list of the form (DIR-REGEXP XML URL) +where: + + DIR-REGEXP is a regular expression that matches a directory; + XML is the file name or URL of the corresponding Doxygen XML tags; and + URL is the URL of the Doxygen documentation that matches that directory. + +For example, if all the files in /home/me/project/foo have their documentation +at http://someplace.com/doc/foo/ and the XML tags file is at +http://someplace.com/doc/foo/foo.xml, and all the files in +/home/me/project/bar have their documentation at +file:///home/me/project/bar/doc/ and the XML tags file is at +/home/me/project/bar/doc/bar.xml, then you would set this list to + + '((\"^/home/me/project/foo/\" + \"http://someplace.com/doc/foo/foo.xml\" + \"http://someplace.com/doc/foo/\") + (\"^/home/me/project/bar/\" + \"~/project/bar/doc/bar.xml\" + \"file:///home/me/project/bar/doc/\"))" + :type 'list + :group 'doxymacs) + +(defcustom doxymacs-doxygen-style + "JavaDoc" + "The style of comments to insert into code. +See http://www.stack.nl/~dimitri/doxygen/docblocks.html#docblocks for examples +of the various styles. + +Must be one of \"JavaDoc\", \"Qt\" or \"C++\". Setting this variable +to anything else will generate errors." + :type '(radio (const :tag "JavaDoc" "JavaDoc") + (const :tag "Qt" "Qt") + (const :tag "C++" "C++")) + :group 'doxymacs) + +(defcustom doxymacs-command-character + nil + "The character to use to introduce Doxygen commands when inserting comments. +If nil, then use the default dictated by `doxymacs-doxygen-style'. Otherwise, +must be one of \"@\" or \"\\\"." + :type '(choice (const :tag "None" nil) + string) + :group 'doxymacs) + +(defcustom doxymacs-use-external-xml-parser + nil + "*Use the external (written in C) XML parser or the internal (LISP) parser. +For smallish tag files, you are better off with the internal parser. +For larger tag files, you are better off with the external one. +Set to non-nil to use the external XML parser." + :type '(choice (const :tag "Yes" t) + (const :tag "No" nil)) + :group 'doxymacs) + +(defcustom doxymacs-external-xml-parser-executable + "" + "*Where the external XML parser executable is." + :type 'string + :group 'doxymacs) + +(defcustom doxymacs-browse-url-function + 'browse-url + "*Function to call to launch a browser to display Doxygen documentation. +This function should take one argument, a string representing the URL to +display." + :type 'function + :group 'doxymacs) + +(defcustom doxymacs-blank-multiline-comment-template + nil + "A tempo template to insert for `doxymacs-insert-blank-multiline-comment'. +If nil, then a default template based on the current style as indicated +by `doxymacs-doxygen-style' will be used. + +For help with tempo templates, see http://www.lysator.liu.se/~davidk/elisp/" + :type 'list + :group 'doxymacs) + +(defcustom doxymacs-blank-singleline-comment-template + nil + "A tempo template to insert for `doxymacs-insert-blank-singleline-comment'. +If nil, then a default template based on the current style as indicated +by `doxymacs-doxygen-style' will be used. + +For help with tempo templates, see http://www.lysator.liu.se/~davidk/elisp/" + :type 'list + :group 'doxymacs) + +(defcustom doxymacs-file-comment-template + nil + "A tempo template to insert for `doxymacs-insert-file-comment'. +If nil, then a default template based on the current style as indicated +by `doxymacs-doxygen-style' will be used. + +For help with tempo templates, see http://www.lysator.liu.se/~davidk/elisp/" + :type 'list + :group 'doxymacs) + +(defcustom doxymacs-function-comment-template + nil + "A tempo template to insert for `doxymacs-insert-function-comment'. +If nil, then a default template based on the current style as +indicated by `doxymacs-doxygen-style' will be used. Note that the +function `doxymacs-find-next-func' is available to you... it returns +an assoc list with the function's name, argument list (BUG: may be +incorrect for parameters that require parentheses), and return +value: + +(cdr (assoc 'func (doxymacs-find-next-func))) is the function name (string). +(cdr (assoc 'args (doxymacs-find-next-func))) is a list of arguments. +(cdr (assoc 'return (doxymacs-find-next-func))) is the return type (string). + +The argument list is a list of strings. + +For help with tempo templates, see http://www.lysator.liu.se/~davidk/elisp/" + :type 'list + :group 'doxymacs) + +(defcustom doxymacs-void-types + "void" + "String with void-kind variable types. Extend this string if there +are typedefs of void. Example: \"void tVOID\"." + :type 'string + :group 'doxymacs) + +(defcustom doxymacs-member-comment-start + nil + "String to insert to start a new member comment. +If nil, use a default one based on the current style as indicated by +`doxymacs-doxygen-style'." + :type '(choice (const :tag "None" nil) + string) + :group 'doxymacs) + +(defcustom doxymacs-member-comment-end + nil + "String to insert to end a new member comment. +If nil, use a default one based on the current style as indicated by +`doxymacs-doxygen-style'. + +Should be an empty string if comments are terminated by end-of-line." + :type '(choice (const :tag "None" nil) + string) + :group 'doxymacs) + +(defcustom doxymacs-group-comment-start + nil + "A string to begin a grouping comment (`doxymacs-insert-grouping-comments'). +If nil, then a default template based on the current style as indicated +by `doxymacs-doxygen-style' will be used." + :type '(choice (const :tag "None" nil) + string) + :group 'doxymacs) + +(defcustom doxymacs-group-comment-end + nil + "A string to end a grouping comment (`doxymacs-insert-grouping-comments'). +If nil, then a default template based on the current style as indicated +by `doxymacs-doxygen-style' will be used." + :type '(choice (const :tag "None" nil) + string) + :group 'doxymacs) + +;; End of customisable variables + +(defvar doxymacs-tags-buffers nil + "The buffers with our Doxygen tags; a list of the form +'((DIR . BUFFER) (...)) where: + + DIR is one of the directories from `doxymacs-doxygen-dirs'; and + BUFFER is the buffer holding the Doxygen tags for that DIR.") + +;; The structure of this list has been chosen for ease of use in the +;; completion functions. +(defvar doxymacs-completion-lists nil + "The lists with doxytags completions. +The structure is as follows: + + ( (dir1 . (symbol-1 . ((description-1a . url-1a) (description-1b . url-1b))) + (symbol-2 . ((description-2a . url-2a)))) + ... ) + +where + + dir1 is one of the directories from `doxymacs-doxygen-dirs'; + symbol-1 is one of the symbols in the associated Doxygen XML file; + description-1a is one of symbol-1's description from the XML file; and + url-1a is the associated URL.") + +(defvar doxymacs-current-completion-list nil + "The current list we are building") + +(defvar doxymacs-completion-buffer "*Completions*" + "The buffer used for displaying multiple completions.") + + + +;; Minor mode implementation + +(defvar doxymacs-mode nil + "nil disables doxymacs, non-nil enables.") + +(make-variable-buffer-local 'doxymacs-mode) + +(defun doxymacs-mode (&optional arg) + ;; All of the following text shows up in the "mode help" (C-h m) + "Minor mode for using/creating Doxygen documentation. +To submit a problem report, request a feature or get support, please +visit doxymacs' homepage at http://doxymacs.sourceforge.net/. + +To see what version of doxymacs you are running, enter +`\\[doxymacs-version]'. + +In order for `doxymacs-lookup' to work you will need to customise the +variable `doxymacs-doxygen-dirs'. + +Key bindings: +\\{doxymacs-mode-map}" + (interactive "P") + (setq doxymacs-mode + (if (null arg) + ;; Toggle mode + (not doxymacs-mode) + ;; Enable/Disable according to arg + (> (prefix-numeric-value arg) 0))) + (when doxymacs-mode + (when (boundp 'filladapt-token-table) + ;; add tokens to filladapt to match doxygen markup + (let ((bullet-regexp "[@\\]\\(param\\(?:\\[\\(?:in\\|out\\|in,out\\)\\]\\)?\\s-+\\sw+\\|return\\)")) + (unless (assoc bullet-regexp filladapt-token-table) + (setq filladapt-token-table + (append filladapt-token-table + (list (list bullet-regexp 'bullet))))))))) + +;; Keymap + +(defvar doxymacs-mode-map (make-sparse-keymap) + "Keymap for doxymacs minor mode.") + +(define-key doxymacs-mode-map "\C-cd?" + 'doxymacs-lookup) +(define-key doxymacs-mode-map "\C-cdr" + 'doxymacs-rescan-tags) + +(define-key doxymacs-mode-map "\C-cdf" + 'doxymacs-insert-function-comment) +(define-key doxymacs-mode-map "\C-cdi" + 'doxymacs-insert-file-comment) +(define-key doxymacs-mode-map "\C-cdm" + 'doxymacs-insert-blank-multiline-comment) +(define-key doxymacs-mode-map "\C-cds" + 'doxymacs-insert-blank-singleline-comment) +(define-key doxymacs-mode-map "\C-cd;" + 'doxymacs-insert-member-comment) +(define-key doxymacs-mode-map "\C-cd@" + 'doxymacs-insert-grouping-comments) + + +;;;###autoload +(or (assoc 'doxymacs-mode minor-mode-alist) + (setq minor-mode-alist + (cons '(doxymacs-mode " doxy") minor-mode-alist))) + +(or (assoc 'doxymacs-mode minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'doxymacs-mode doxymacs-mode-map) + minor-mode-map-alist))) + +;; This stuff has to do with fontification +;; Thanks to Alec Panovici for the idea. + +(defconst doxymacs-doxygen-keywords + (list + (list + ;; One shot keywords that take no arguments + (concat "\\([@\\\\]\\(brief\\|li\\|\\(end\\)?code\\|sa" + "\\|note\\|\\(end\\)?verbatim\\|return\\|arg\\|fn" + "\\|hideinitializer\\|showinitializer" + ;; FIXME + ;; How do I get & # < > % to work? + ;;"\\|\\\\&\\|\\$\\|\\#\\|<\\|>\\|\\%" + "\\|\\$" + "\\|internal\\|nosubgrouping\\|author\\|date\\|endif" + "\\|invariant\\|post\\|pre\\|remarks\\|since\\|test\\|version" + "\\|\\(end\\)?htmlonly\\|\\(end\\)?latexonly\\|f\\$\\|file" + "\\|\\(end\\)?xmlonly\\|\\(end\\)?manonly\\|property" + "\\|mainpage\\|name\\|overload\\|typedef\\|deprecated\\|par" + "\\|addindex\\|line\\|skip\\|skipline\\|until\\|see" + "\\|endlink\\|callgraph\\|endcond\\|else\\)\\)\\>") + '(0 font-lock-keyword-face prepend)) + ;; attention, warning, etc. given a different font + (list + "\\([@\\\\]\\(attention\\|warning\\|todo\\|bug\\)\\)\\>" + '(0 font-lock-warning-face prepend)) + ;; keywords that take a variable name as an argument + (list + (concat "\\([@\\\\]\\(param\\(?:\\[\\(?:in\\|out\\|in,out\\)\\]\\)?" + "\\|a\\|namespace\\|relates\\(also\\)?" + "\\|var\\|def\\)\\)\\s-+\\(\\sw+\\)") + '(1 font-lock-keyword-face prepend) + '(4 font-lock-variable-name-face prepend)) + ;; keywords that take a type name as an argument + (list + (concat "\\([@\\\\]\\(class\\|struct\\|union\\|exception\\|enum" + "\\|throw\\|interface\\|protocol\\)\\)\\s-+\\(\\(\\sw\\|:\\)+\\)") + '(1 font-lock-keyword-face prepend) + '(3 font-lock-type-face prepend)) + ;; keywords that take a function name as an argument + (list + "\\([@\\\\]retval\\)\\s-+\\([^ \t\n]+\\)" + '(1 font-lock-keyword-face prepend) + '(2 font-lock-function-name-face prepend)) + ;; bold + (list + "\\([@\\\\]b\\)\\s-+\\([^ \t\n]+\\)" + '(1 font-lock-keyword-face prepend) + '(2 (quote bold) prepend)) + ;; code + (list + "\\([@\\\\][cp]\\)\\s-+\\([^ \t\n]+\\)" + '(1 font-lock-keyword-face prepend) + '(2 (quote underline) prepend)) + ;; italics/emphasised + (list + "\\([@\\\\]e\\(m\\)?\\)\\s-+\\([^ \t\n]+\\)" + '(1 font-lock-keyword-face prepend) + '(3 (quote italic) prepend)) + ;; keywords that take a list + (list + "\\([@\\\\]ingroup\\)\\s-+\\(\\(\\sw+\\s-*\\)+\\)\\s-*$" + '(1 font-lock-keyword-face prepend) + '(2 font-lock-string-face prepend)) + ;; one argument that can contain arbitrary non-whitespace stuff + (list + (concat "\\([@\\\\]\\(link\\|copydoc\\|xrefitem" + "\\|if\\(not\\)?\\|elseif\\)\\)" + "\\s-+\\([^ \t\n]+\\)") + '(1 font-lock-keyword-face prepend) + '(4 font-lock-string-face prepend)) + ;; one optional argument that can contain arbitrary non-whitespace stuff + (list + "\\([@\\\\]\\(cond\\|dir\\)\\(\\s-+[^ \t\n]+\\)?\\)" + '(1 font-lock-keyword-face prepend) + '(3 font-lock-string-face prepend t)) + ;; one optional argument with no space between + (list + "\\([@\\\\]\\(~\\)\\([^ \t\n]+\\)?\\)" + '(1 font-lock-keyword-face prepend) + '(3 font-lock-string-face prepend t)) + ;; one argument that has to be a filename + (list + (concat "\\([@\\\\]\\(example\\|\\(dont\\)?include\\|includelineno" + "\\|htmlinclude\\|verbinclude\\)\\)\\s-+" + "\\(\"?[~:\\/a-zA-Z0-9_. ]+\"?\\)") + '(1 font-lock-keyword-face prepend) + '(4 font-lock-string-face prepend)) + ;; dotfile <file> ["caption"] + (list + (concat "\\([@\\\\]dotfile\\)\\s-+" + "\\(\"?[~:\\/a-zA-Z0-9_. ]+\"?\\)\\(\\s-+\"[^\"]+\"\\)?") + '(1 font-lock-keyword-face prepend) + '(2 font-lock-string-face prepend) + '(3 font-lock-string-face prepend t)) + ;; image <format> <file> ["caption"] [<sizeindication>=<size>] + (list + "\\([@\\\\]image\\)\\s-+\\(html\\|latex\\)\\s-+\\(\"?[~:\\/a-zA-Z0-9_. ]+\"?\\)\\(\\s-+\"[^\"]+\"\\)?\\(\\s-+\\sw+=[0-9]+\\sw+\\)?" + '(1 font-lock-keyword-face prepend) + '(2 font-lock-string-face prepend) + '(3 font-lock-string-face prepend) + '(4 font-lock-string-face prepend t) + '(5 font-lock-string-face prepend t)) + ;; one argument that has to be a word + (list + (concat "\\([@\\\\]\\(addtogroup\\|defgroup\\|weakgroup" + "\\|page\\|anchor\\|ref\\|section\\|subsection" + "\\)\\)\\s-+\\(\\sw+\\)") + '(1 font-lock-keyword-face prepend) + '(3 font-lock-string-face prepend)))) + +(defun doxymacs-font-lock () + "Turn on font-lock for Doxygen keywords." + ;; FIXME How do I turn *off* font-lock for Doxygen keywords? + (interactive) + (if (functionp 'font-lock-add-keywords) + ;; Use new (proper?) font-lock-add-keywords function + (font-lock-add-keywords nil doxymacs-doxygen-keywords) + ;; Use old-school way + (let ((old (if (eq (car-safe font-lock-keywords) t) + (cdr font-lock-keywords) + font-lock-keywords))) + (setq font-lock-keywords (append old doxymacs-doxygen-keywords))))) + + + + +;;These functions have to do with looking stuff up in doxygen generated +;;documentation + + +;; Utility functions to look up filenames in the various association lists +;; we have + +(defun doxymacs-filename-to-element (f a) + "Lookup filename in one of our association lists and return associated +element" + (catch 'done + (while a + (if (string-match (caar a) f) + (throw 'done + (cdar a)) + (setq a (cdr a)))))) + +(defun doxymacs-filename-to-xml (f) + "Lookup filename in `doxymacs-doxygen-dirs' and return associated XML tags +file." + (let ((xml-url (doxymacs-filename-to-element f doxymacs-doxygen-dirs))) + (if xml-url + (car xml-url)))) + +(defun doxymacs-filename-to-url (f) + "Lookup filename in `doxymacs-doxygen-dirs' and return associated Doxygen +documentation URL root." + (let ((xml-url (doxymacs-filename-to-element f doxymacs-doxygen-dirs))) + (if xml-url + (cadr xml-url)))) + +(defun doxymacs-filename-to-buffer (f) + "Lookup filename in `doxymacs-tags-buffers' and return associated buffer." + (doxymacs-filename-to-element f doxymacs-tags-buffers)) + +(defun doxymacs-filename-to-completion-list (f) + "Lookup filename in `doxymacs-completion-lists' and return associated +completion list." + (doxymacs-filename-to-element f doxymacs-completion-lists)) + +(defun doxymacs-filename-to-dir (f) + "Lookup filename in `doxymacs-doxygen-dirs' and return associated dir." + (catch 'done + (let ((dirs doxymacs-doxygen-dirs)) + (while dirs + (if (string-match (caar dirs) f) + (throw 'done + (caar dirs)) + (setq dirs (cdr dirs))))))) + +(defun doxymacs-set-dir-element (dir l e) + "Set the element associated with dir in l to e." + (catch 'done + (while l + (let ((pair (car l))) + (if (string= (car pair) dir) + (throw 'done + (setcdr pair e)) + (setq l (cdr l))))))) + +(defun doxymacs-set-tags-buffer (dir buffer) + "Set the buffer associated with dir in `doxymacs-tags-buffers' to the given +buffer." + (doxymacs-set-dir-element dir doxymacs-tags-buffers buffer)) + +(defun doxymacs-set-completion-list (dir comp-list) + "Set the completion list associated with dir in `doxymcas-completion-lists' +to comp-list." + (doxymacs-set-dir-element dir doxymacs-completion-lists comp-list)) + +(defun doxymacs-url-exists-p (url) + "Return t iff the URL exists." + (let* ((urlobj (url-generic-parse-url url)) + (type (url-type urlobj)) + (exists nil)) + (cond + ((equal type "http") + (cond + ;; Try url-file-exists, if it exists + ((fboundp 'url-file-exists) + (setq exists (url-file-exists url))) + ;; Otherwise, try url-file-exists-p (newer url.el) + ((fboundp 'url-file-exists-p) + (setq exists (url-file-exists-p url))) + ;; Otherwise, try wget + ((executable-find (if (eq system-type 'windows-nt) "wget.exe" "wget")) + (if (string-match "200 OK" + (shell-command-to-string + (concat "wget -S --spider " url))) + (setq exists t))) + ;; Otherwise, try lynx + ((executable-find (if (eq system-type 'windows-nt) "lynx.exe" "lynx")) + (if (string-match "200 OK" + (shell-command-to-string + (concat "lynx -head -source " url))) + (setq exists t))) + ;; Give up. + (t (error "Could not find url-file-exists, url-file-exists-p, wget or lynx")))) + ((equal type "file") + (setq exists (file-exists-p (url-filename urlobj)))) + (t (error (concat "Scheme " type " not supported for URL " url)))) + exists)) + +(defun doxymacs-load-tags (f) + "Loads a Doxygen generated XML tags file into the buffer *doxytags*." + (let* ((tags-buffer (doxymacs-filename-to-buffer f)) + (dir (doxymacs-filename-to-dir f)) + (xml (doxymacs-filename-to-xml f))) + (if (and xml dir) + (if (or (eq tags-buffer nil) + (eq (buffer-live-p tags-buffer) nil)) + (let ((new-buffer (generate-new-buffer "*doxytags"))) + (if tags-buffer + ;; tags-buffer is non-nil, which means someone + ;; killed the buffer... so reset it + (doxymacs-set-tags-buffer dir new-buffer) + ;; Otherwise add to list + (setq doxymacs-tags-buffers + (cons (cons dir new-buffer) doxymacs-tags-buffers))) + (message (concat "Loading " xml "...")) + (let ((currbuff (current-buffer))) + (if (file-regular-p xml) + ;;It's a regular file, so just grab it. + (progn + (set-buffer new-buffer) + (insert-file-contents xml)) + ;; Otherwise, try and grab it as a URL + (progn + (if (doxymacs-url-exists-p xml) + (progn + (set-buffer new-buffer) + (url-insert-file-contents xml) + (set-buffer-modified-p nil)) + (progn + (kill-buffer new-buffer) + (set-buffer currbuff) + (error (concat + "Tag file " xml " not found.")))))) + (set-buffer currbuff)))) + ;; Couldn't find this file in doxymacs-doxygen-dirs + (error (concat "File " (buffer-file-name) + " does not match any directories in" + " doxymacs-doxygen-dirs."))))) + +(defun doxymacs-add-to-completion-list (symbol desc url) + "Add a symbol to our completion list, along with its description and URL." + (let ((check (assoc symbol doxymacs-current-completion-list))) + (if check + ;; There is already a symbol with the same name in the list + (if (not (assoc desc (cdr check))) + ;; If there is not yet a symbol with this desc, add it + ;; FIXME: what to do if there is already a symbol?? + (setcdr check (cons (cons desc url) + (cdr check)))) + ;; There is not yet a symbol with this name in the list + (setq doxymacs-current-completion-list + (cons (cons symbol (list (cons desc url))) + doxymacs-current-completion-list))))) + +(defun doxymacs-fill-completion-list-with-external-parser (f) + "Use external parser to parse Doxygen XML tags file and get the +completion list." + (doxymacs-load-tags f) + (let ((currbuff (current-buffer)) + (dir (doxymacs-filename-to-dir f)) + (comp-list (doxymacs-filename-to-completion-list f)) + (tags-buffer (doxymacs-filename-to-buffer f))) + (set-buffer tags-buffer) + (goto-char (point-min)) + (doxymacs-set-completion-list dir nil) + (message (concat + "Executing external process " + doxymacs-external-xml-parser-executable + "...")) + (let ((status (call-process-region + (point-min) (point-max) + doxymacs-external-xml-parser-executable + t t))) + (if (eq status 0) + (progn + (goto-char (point-min)) + (message "Reading completion list...") + (let ((new-list (read (current-buffer)))) + (if comp-list + ;; Replace + (doxymacs-set-completion-list dir new-list) + ;; Add + (setq doxymacs-completion-lists + (cons (cons dir new-list) + doxymacs-completion-lists)))) + (message "Done.") + (set-buffer-modified-p nil) + (kill-buffer tags-buffer) + (set-buffer currbuff)) + (progn + (switch-to-buffer tags-buffer) + (message (concat + "There were problems parsing " + (doxymacs-filename-to-xml f) "."))))))) + + +(defun doxymacs-xml-progress-callback (amount-done) + "Let the user know how far along the XML parsing is." + (message (concat "Parsing ... " (format "%0.1f" amount-done) "%%"))) + +(defun doxymacs-fill-completion-list-with-internal-parser (f) + "Load and parse the tags from the *doxytags* buffer, constructing our +`doxymacs-completion-list' from it using the internal XML file parser." + (doxymacs-load-tags f) + (let ((currbuff (current-buffer)) + (dir (doxymacs-filename-to-dir f)) + (tags-buffer (doxymacs-filename-to-buffer f))) + (set-buffer tags-buffer) + (goto-char (point-min)) + (setq doxymacs-current-completion-list nil) + (let ((xml (read-xml 'doxymacs-xml-progress-callback))) ;Parse the file + (let* ((compound-list (xml-tag-children xml)) + (num-compounds (length compound-list)) + (curr-compound-num 0)) + (if (not (string= (xml-tag-name xml) "tagfile")) + (error (concat "Invalid tag file: " (doxymacs-filename-to-xml f))) + ;; Go through the compounds, adding them and their members to the + ;; completion list. + (while compound-list + (let* ((curr-compound (car compound-list)) + (compound-name (cadr (xml-tag-child curr-compound "name"))) + (compound-kind (xml-tag-attr curr-compound "kind")) + (compound-url (cadr + (xml-tag-child curr-compound "filename"))) + (compound-desc (concat compound-kind " " compound-name))) + ;; Work around apparent bug in Doxygen 1.2.18 + (if (not (string-match "\\.html$" compound-url)) + (setq compound-url (concat compound-url ".html"))) + + ;; Add this compound to our completion list for this directory + (doxymacs-add-to-completion-list compound-name + compound-desc + compound-url) + ;; Add its members + (doxymacs-add-compound-members curr-compound + compound-name + compound-url) + ;; On to the next compound + (message (concat + "Building completion table... " + (format "%0.1f" + (* (/ + (float curr-compound-num) + (float num-compounds)) + 100)) + "%%")) + (setq curr-compound-num (1+ curr-compound-num)) + (setq compound-list (cdr compound-list))))))) + (if (doxymacs-filename-to-completion-list f) + ;; Replace + (doxymacs-set-completion-list dir doxymacs-current-completion-list) + ;; Add + (setq doxymacs-completion-lists + (cons (cons dir doxymacs-current-completion-list) + doxymacs-completion-lists))) + (setq doxymacs-current-completion-list nil) + (message "Done.") + ;; Don't need the doxytags buffer anymore + (set-buffer-modified-p nil) + (kill-buffer tags-buffer) + (set-buffer currbuff))) + +(defun doxymacs-add-compound-members (compound compound-name compound-url) + "Get the members of the given compound" + (let ((children (xml-tag-children compound))) + ;; Run through the children looking for ones with the "member" tag + (while children + (let* ((curr-child (car children))) + (if (string= (xml-tag-name curr-child) "member") + ;; Found a member. Throw it on the list. + (let* ((member-name (cadr (xml-tag-child curr-child "name"))) + (member-anchor (cadr (xml-tag-child curr-child "anchor"))) + (member-url (concat compound-url "#" member-anchor)) + (member-args (if (cdr (xml-tag-child curr-child "arglist")) + (cadr (xml-tag-child curr-child "arglist")) + "")) + (member-desc (concat compound-name "::" + member-name member-args))) + (doxymacs-add-to-completion-list member-name + member-desc + member-url))) + (setq children (cdr children)))))) + +(defun doxymacs-display-url (root url) + "Displays the given match." + (apply doxymacs-browse-url-function (list (concat root "/" url)))) + +;; Some versions of GNU Emacs don't have symbol-near-point apparently +;; stolen from browse-cltl2.el, and in turn: +;; stolen from XEmacs 19.15 syntax.el +(defun doxymacs-symbol-near-point () + "Return the first textual item to the nearest point." + (if (fboundp 'symbol-near-point) + (symbol-near-point) + ;;alg stolen from etag.el + (save-excursion + (if (not (memq (char-syntax (preceding-char)) '(?w ?_))) + (while (not (looking-at "\\sw\\|\\s_\\|\\'")) + (forward-char 1))) + (while (looking-at "\\sw\\|\\s_") + (forward-char 1)) + (if (re-search-backward "\\sw\\|\\s_" nil t) + (regexp-quote + (progn (forward-char 1) + (buffer-substring (point) + (progn (forward-sexp -1) + (while (looking-at "\\s'") + (forward-char 1)) + (point))))) + nil)))) + +(defun doxymacs-lookup (symbol &optional filename) + "Look up the symbol under the cursor in Doxygen generated documentation." + (interactive + (let* ((f (buffer-file-name)) + (completion-list (doxymacs-filename-to-completion-list f))) + (if (eq f nil) + (error "Current buffer has no file name associated with it.") + (progn + (save-excursion + (if (eq completion-list nil) + ;;Build our completion list if not already done + (if doxymacs-use-external-xml-parser + (doxymacs-fill-completion-list-with-external-parser f) + (doxymacs-fill-completion-list-with-internal-parser f))) + (let ((symbol (completing-read + "Look up: " + completion-list nil nil + (doxymacs-symbol-near-point))) + (filename f)) + (list symbol filename))))))) + (let ((url (doxymacs-symbol-completion + symbol + (doxymacs-filename-to-completion-list filename)))) + (if url + (doxymacs-display-url (doxymacs-filename-to-url filename) url)))) + +(defun doxymacs-display-completions (initial collection &optional pred) + "Display available completions." + (let ((matches (all-completions initial collection pred))) + ;; FIXME - Is this the proper way of doing this? Seems to work, but... + (set-buffer (format " *Minibuf-%d*" + ;; Here's a kludge. + (if (featurep 'xemacs) + (minibuffer-depth) + (1+ (minibuffer-depth))))) + (with-output-to-temp-buffer doxymacs-completion-buffer + (display-completion-list (sort matches 'string-lessp))))) + +(defun doxymacs-symbol-completion (initial collection &optional pred) + "Do completion for given symbol." + (let ((completion (try-completion initial collection pred))) + (cond ((eq completion t) + ;; Only one completion found. Validate it. + (doxymacs-validate-symbol-completion initial collection pred)) + ((null completion) + ;; No completion found + (message "No documentation for '%s'" initial) + (ding)) + (t + ;; There is more than one possible completion + (doxymacs-display-completions initial collection pred) + (let ((completion (completing-read + "Select: " + collection pred nil initial))) + (delete-window (get-buffer-window doxymacs-completion-buffer)) + (if completion + ;; If there is a completion, validate it. + (doxymacs-validate-symbol-completion + completion collection pred) + ;; Otherwise just return nil + nil)))))) + +(defun doxymacs-validate-symbol-completion (initial collection &optional pred) + "Checks whether the symbol (initial) has multiple descriptions, and if so +continue completion on those descriptions. In the end it returns the URL for +the completion or nil if canceled by the user." + (let ((new-collection (cdr (assoc initial collection)))) + (if (> (length new-collection) 1) + ;; More than one + (doxymacs-description-completion "" new-collection pred) + ;; Only one, return the URL + (cdar new-collection)))) + +(defun doxymacs-description-completion (initial collection &optional pred) + "Do completion for given description." + (doxymacs-display-completions initial collection pred) + (let ((completion (completing-read "Select: " collection pred nil initial))) + (delete-window (get-buffer-window doxymacs-completion-buffer)) + (if completion + ;; Return the URL if there is a completion + (cdr (assoc completion collection))))) + +;;This is mostly a convenience function for the user +(defun doxymacs-rescan-tags () + "Rescan the Doxygen XML tags file in `doxymacs-doxygen-tags'." + (interactive) + (let* ((f (buffer-file-name)) + (tags-buffer (doxymacs-filename-to-buffer f))) + (if (buffer-live-p tags-buffer) + (kill-buffer tags-buffer)) + (if doxymacs-use-external-xml-parser + (doxymacs-fill-completion-list-with-external-parser f) + (doxymacs-fill-completion-list-with-internal-parser f)))) + + +;; These functions have to do with inserting doxygen commands in code + +;; FIXME +;; So, in the source code for XEmacs 21.1.14, they commented out the +;; definition of deactivate-mark for some reason... and the tempo package +;; needs it. So, here is a placeholder just to get it to stop +;; complaining. This is a hack, since I don't know what the proper fix +;; should be. +(if (not (fboundp 'deactivate-mark)) + (defsubst deactivate-mark () + (zmacs-deactivate-region))) ; Is this correct? +;; Also need a hack for mark-active +(if (not (boundp 'mark-active)) + (defvar mark-active nil)) ; Is this correct? Probably not. + + +;; Default templates + +(defconst doxymacs-JavaDoc-blank-multiline-comment-template + '("/**" > n "* " p > n "* " > n "*/" > n) + "Default JavaDoc-style template for a blank multiline doxygen comment.") + +(defconst doxymacs-Qt-blank-multiline-comment-template + '("//! " p > n "/*! " > n > n "*/" > n) + "Default Qt-style template for a blank multiline doxygen comment.") + +(defconst doxymacs-C++-blank-multiline-comment-template + '("///" > n "/// " p > n "///" > n) + "Default C++-style template for a blank multiline doxygen comment.") + +(defconst doxymacs-JavaDoc-blank-singleline-comment-template + '("/// " > p) + "Default JavaDoc-style template for a blank single line doxygen comment.") + +(defconst doxymacs-Qt-blank-singleline-comment-template + '("//! " > p) + "Default Qt-style template for a blank single line doxygen comment.") + +(defconst doxymacs-C++-blank-singleline-comment-template + '("/// " > p) + "Default C++-style template for a blank single line doxygen comment.") + +(defun doxymacs-doxygen-command-char () + (cond + (doxymacs-command-character doxymacs-command-character) + ((string= doxymacs-doxygen-style "JavaDoc") "@") + ((string= doxymacs-doxygen-style "Qt") "\\") + ((string= doxymacs-doxygen-style "C++") "@") + (t "@"))) + +(defconst doxymacs-JavaDoc-file-comment-template + '("/**" > n + " * " (doxymacs-doxygen-command-char) "file " + (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "") > n + " * " (doxymacs-doxygen-command-char) "author " (user-full-name) + (if (fboundp 'user-mail-address) + (list 'l " <" (user-mail-address) ">")) + > n + " * " (doxymacs-doxygen-command-char) "date " (current-time-string) > n + " * " > n + " * " (doxymacs-doxygen-command-char) "brief " (p "Brief description of this file: ") > n + " * " > n + " * " p > n + " */" > n) + "Default JavaDoc-style template for file documentation.") + +(defconst doxymacs-Qt-file-comment-template + '("/*!" > n + " " (doxymacs-doxygen-command-char) "file " + (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "") > n + " " (doxymacs-doxygen-command-char) "author " (user-full-name) + (if (fboundp 'user-mail-address) + (list 'l " <" (user-mail-address) ">")) + > n + " " (doxymacs-doxygen-command-char) "date " (current-time-string) > n + " " > n + " " (doxymacs-doxygen-command-char) "brief " (p "Brief description of this file: ") > n + " " > n + " " p > n + "*/" > n) + "Default Qt-style template for file documentation.") + +(defconst doxymacs-C++-file-comment-template + '("///" > n + "/// " (doxymacs-doxygen-command-char) "file " + (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "") > n + "/// " (doxymacs-doxygen-command-char) "author " (user-full-name) + (if (fboundp 'user-mail-address) + (list 'l " <" (user-mail-address) ">")) + > n + "/// " (doxymacs-doxygen-command-char) "date " (current-time-string) > n + "/// " > n + "/// " (doxymacs-doxygen-command-char) "brief " (p "Brief description of this file: ") > n + "/// " > n + "/// " p > n + "///" > n) + "Default C++-style template for file documentation.") + + +(defun doxymacs-parm-tempo-element (parms) + "Inserts tempo elements for the given parms in the given style." + (if parms + (let ((prompt (concat "Parameter " (car parms) ": "))) + (cond + ((string= doxymacs-doxygen-style "JavaDoc") + (list 'l " * " (doxymacs-doxygen-command-char) + "param " (car parms) " " (list 'p prompt) '> 'n + (doxymacs-parm-tempo-element (cdr parms)))) + ((string= doxymacs-doxygen-style "Qt") + (list 'l " " (doxymacs-doxygen-command-char) + "param " (car parms) " " (list 'p prompt) '> 'n + (doxymacs-parm-tempo-element (cdr parms)))) + ((string= doxymacs-doxygen-style "C++") + (list 'l "/// " (doxymacs-doxygen-command-char) + "param " (car parms) " " (list 'p prompt) '> 'n + (doxymacs-parm-tempo-element (cdr parms)))) + (t + (doxymacs-invalid-style)))) + nil)) + + +(defconst doxymacs-JavaDoc-function-comment-template + '((let ((next-func (doxymacs-find-next-func))) + (if next-func + (list + 'l + "/** " '> 'n + " * " 'p '> 'n + " * " '> 'n + (doxymacs-parm-tempo-element (cdr (assoc 'args next-func))) + (unless (string-match + (regexp-quote (cdr (assoc 'return next-func))) + doxymacs-void-types) + '(l " * " > n " * " (doxymacs-doxygen-command-char) + "return " (p "Returns: ") > n)) + " */" '>) + (progn + (error "Can't find next function declaration.") + nil)))) + "Default JavaDoc-style template for function documentation.") + +(defconst doxymacs-Qt-function-comment-template + '((let ((next-func (doxymacs-find-next-func))) + (if next-func + (list + 'l + "//! " 'p '> 'n + "/*! " '> 'n + " " '> 'n + (doxymacs-parm-tempo-element (cdr (assoc 'args next-func))) + (unless (string-match + (regexp-quote (cdr (assoc 'return next-func))) + doxymacs-void-types) + '(l " " > n " " (doxymacs-doxygen-command-char) + "return " (p "Returns: ") > n)) + " */" '>) + (progn + (error "Can't find next function declaraton.") + nil)))) + "Default Qt-style template for function documentation.") + +(defconst doxymacs-C++-function-comment-template + '((let ((next-func (doxymacs-find-next-func))) + (if next-func + (list + 'l + "/// " 'p '> 'n + "///" '> 'n + (doxymacs-parm-tempo-element (cdr (assoc 'args next-func))) + (unless (string-match + (regexp-quote (cdr (assoc 'return next-func))) + doxymacs-void-types) + '(l "///" > n "/// " (doxymacs-doxygen-command-char) + "return " (p "Returns: ") > n)) + "///" '>) + (progn + (error "Can't find next function declaraton.") + nil)))) + "Default C++-style template for function documentation.") + +(defun doxymacs-invalid-style () + "Warn the user that he has set `doxymacs-doxygen-style' to an invalid +style." + (error (concat + "Invalid `doxymacs-doxygen-style': " + doxymacs-doxygen-style + ": must be one of \"JavaDoc\", \"Qt\" or \"C++\"."))) + +;; This should make it easier to add new templates and cut down +;; on copy-and-paste programming. +(defun doxymacs-call-template (template-name) + "Insert the given template." + (let* ((user-template-name (concat "doxymacs-" template-name "-template")) + (user-template (car (read-from-string user-template-name))) + (default-template-name (concat "doxymacs-" + doxymacs-doxygen-style "-" + template-name "-template")) + (default-template (car (read-from-string default-template-name)))) + (cond + ((and (boundp user-template) ; Make sure it is a non-nil list + (listp (eval user-template)) + (eval user-template)) + ;; Use the user's template + (tempo-insert-template user-template tempo-insert-region)) + ((and (boundp default-template) + (listp (eval default-template)) + (eval default-template)) + ;; Use the default template, based on the current style + (tempo-insert-template default-template tempo-insert-region)) + (t + ;; Most likely, `doxymacs-doxygen-style' has been set wrong. + (doxymacs-invalid-style))))) + +(defun doxymacs-insert-blank-multiline-comment () + "Inserts a multi-line blank Doxygen comment at the current point." + (interactive "*") + (doxymacs-call-template "blank-multiline-comment")) + +(defun doxymacs-insert-blank-singleline-comment () + "Inserts a single-line blank Doxygen comment at current point." + (interactive "*") + (doxymacs-call-template "blank-singleline-comment")) + +(defun doxymacs-insert-file-comment () + "Inserts Doxygen documentation for the current file at current point." + (interactive "*") + (doxymacs-call-template "file-comment")) + +(defun doxymacs-insert-function-comment () + "Inserts Doxygen documentation for the next function declaration at +current point." + (interactive "*") + (doxymacs-call-template "function-comment")) + +;; FIXME +;; The following was borrowed from "simple.el". +;; If anyone knows of a better/simpler way of doing this, please let me know. +(defconst doxymacs-comment-indent-function + (lambda (skip) + (save-excursion + (beginning-of-line) + (let ((eol (save-excursion (end-of-line) (point)))) + (and skip + (re-search-forward skip eol t) + (setq eol (match-beginning 0))) + (goto-char eol) + (skip-chars-backward " \t") + (max comment-column (1+ (current-column)))))) + "Function to compute desired indentation for a comment. +This function is called with skip and with point at the beginning of +the comment's starting delimiter.") + +(defun doxymacs-insert-member-comment () + "Inserts Doxygen documentation for the member on the current line in +the column given by `comment-column' (much like \\[indent-for-comment])." + (interactive "*") + (let* ((empty (save-excursion (beginning-of-line) + (looking-at "[ \t]*$"))) + (starter (or doxymacs-member-comment-start + (cond + ((string= doxymacs-doxygen-style "JavaDoc") + "/**< ") + ((string= doxymacs-doxygen-style "Qt") + "/*!< ") + ((string= doxymacs-doxygen-style "C++") + "///< ") + (t + (doxymacs-invalid-style))))) + (skip (concat (regexp-quote starter) "*")) + (ender (or doxymacs-member-comment-end + (cond + ((string= doxymacs-doxygen-style "JavaDoc") + " */") + ((string= doxymacs-doxygen-style "Qt") + " */") + ((string= doxymacs-doxygen-style "C++") + "") + (t + (doxymacs-invalid-style)))))) + (if empty + ;; Insert a blank single-line comment on empty lines + (doxymacs-insert-blank-singleline-comment) + (if (null starter) + (error "No Doxygen member comment syntax defined") + (let* ((eolpos (save-excursion (end-of-line) (point))) + cpos indent begpos) + (beginning-of-line) + (if (re-search-forward skip eolpos 'move) + (progn (setq cpos (point-marker)) + ;; Find the start of the comment delimiter. + ;; If there were paren-pairs in skip, + ;; position at the end of the first pair. + (if (match-end 1) + (goto-char (match-end 1)) + ;; If skip matched a string with + ;; internal whitespace (not final whitespace) then + ;; the delimiter start at the end of that + ;; whitespace. Otherwise, it starts at the + ;; beginning of what was matched. + (skip-syntax-backward " " (match-beginning 0)) + (skip-syntax-backward "^ " (match-beginning 0))))) + (setq begpos (point)) + ;; Compute desired indent. + (cond + ((= (current-column) 0) + (goto-char begpos)) + ((= (current-column) + (setq indent (funcall doxymacs-comment-indent-function skip))) + (goto-char begpos)) + (t + ;; If that's different from current, change it. + (skip-chars-backward " \t") + (delete-region (point) begpos) + (indent-to indent))) + ;; An existing comment? + (if cpos + (progn (goto-char cpos) + (set-marker cpos nil)) + ;; No, insert one. + (insert starter) + (save-excursion + (insert ender)))))))) + +(defun doxymacs-insert-grouping-comments (start end) + "Inserts doxygen grouping comments around the current region." + (interactive "*r") + (let* ((starter (or doxymacs-group-comment-start + (cond + ((string= doxymacs-doxygen-style "JavaDoc") + "//@{") + ((string= doxymacs-doxygen-style "Qt") + "/*@{*/") + ((string= doxymacs-doxygen-style "C++") + "/// @{") + (t + (doxymacs-invalid-style))))) + (ender (or doxymacs-group-comment-end + (cond + ((string= doxymacs-doxygen-style "JavaDoc") + "//@}") + ((string= doxymacs-doxygen-style "Qt") + "/*@}*/") + ((string= doxymacs-doxygen-style "C++") + "/// @}") + (t + (doxymacs-invalid-style)))))) + (save-excursion + (goto-char end) + (end-of-line) + (insert ender) + (goto-char start) + (beginning-of-line) + (insert starter)))) + + + +;; These are helper functions that search for the next function +;; declerations/definition and extract its name, return type and +;; argument list. Used for documenting functions. + +(defun doxymacs-extract-args-list (args-string) + "Extracts the arguments from the given list (given as a string)." + (cond + ;; arg list is empty + ((string-match "\\`[ \t\n]*\\'" args-string) + nil) + ;; argument list consists of one word + ((string-match "\\`[ \t\n]*\\([a-zA-Z0-9_]+\\)[ \t\n]*\\'" args-string) + ;; ... extract this word + (let ((arg (substring args-string (match-beginning 1) (match-end 1)))) + ;; if this arg is a void type return nil + (if (string-match (regexp-quote arg) doxymacs-void-types) + nil + ;; else return arg + (list arg)))) + ;; else split the string and extact var names from args + (t + (doxymacs-extract-args-list-helper + (doxymacs-save-split args-string))))) + + +(defun doxymacs-save-split (args-string) + "Splits a declaration list as string and returns list of single +declarations." + (let ((comma-pos (string-match "," args-string)) + (paren-pos (string-match "(" args-string))) + (cond + ;; no comma in string found + ((null comma-pos) (list args-string)) + ;; comma but no parenthethes: split-string is save + ((null paren-pos) (split-string args-string ",")) + ;; comma first then parenthesis + ((< comma-pos paren-pos) + (cons (substring args-string 0 comma-pos) + (doxymacs-save-split (substring args-string (1+ comma-pos))))) + ;; parenthesis first then comma. there must exist a closing parenthesis + (t + ;; cut off the (...) part + (save-excursion + ;; create temporary buffer + (set-buffer (get-buffer-create "*doxymacs-scratch*")) + (erase-buffer) + (insert args-string) + (beginning-of-buffer) + (search-forward "(") + (prog1 + (let ((depth 1) + (exit) + (comma-found)) + (while (not exit) + ;; step through buffer + (forward-char 1) + (cond + ;; end of buffer: exit + ((= (point) (point-max)) (setq exit t)) + ;; decrease depth counter + ((looking-at ")") (setq depth (1- depth))) + ;; increase depth counter + ((looking-at "(") (setq depth (1+ depth))) + ;; comma at depth 0, thats it! + ((and (looking-at ",") (= 0 depth)) + (setq exit t) + (setq comma-found t)))) + (if (not comma-found) + ;; whole string is one arg + (list (buffer-substring 1 (point))) + ;; else split at comma ... + (cons (buffer-substring 1 (point)) + ;; and split rest of declaration list + (doxymacs-save-split + (buffer-substring (1+ (point)) (point-max)))))) + (kill-buffer (current-buffer)))))))) + + +;; This regexp fails if the opt. parentheses +;; contain another level of parentheses. E.g. for: +;; int f(int (*g)(int (*h)())) +(defun doxymacs-extract-args-list-helper (args-list) + "Recursively get names of arguments." + (if args-list + (if (string-match + (concat + "\\(" + "([ \t\n]*\\*[ \t\n]*\\([a-zA-Z0-9_]+\\)[ \t\n]*)"; (*varname) + "\\|" ; or + "\\*?[ \t\n]*\\([a-zA-Z0-9_]+\\)" ; opt. *, varname + "\\)" + "[ \t\n]*" ; opt. spaces + "\\(\\[[ \t\n]*[a-zA-Z0-9_]*[ \t\n]*\\]\\|" ; opt. array bounds + "([^()]*)\\)?" ; or opt. func args + "[ \t\n]*" ; opt. spaces + "\\(=[ \t\n]*[^ \t\n]+[ \t\n]*\\)?" ; optional assignment + "[ \t\n]*\\'" ; end + ) (car args-list)) + (cons + (cond + ;; var name in: (*name) + ((match-beginning 2) + (substring (car args-list) (match-beginning 2) (match-end 2))) + ;; var name in: *name + ((match-beginning 3) + (substring (car args-list) (match-beginning 3) (match-end 3))) + ;; no match: return complete declaration + (t + (car args-list))) + (doxymacs-extract-args-list-helper (cdr args-list))) + ;; else there is no match + nil))) + +(defun doxymacs-core-string (s) + "Returns the argument string with leading and trailing blank +and new-line characters cut off." + (string-match "\\`[ \t\n]*\\(.*?\\)[ \t\n]*\\'" s) + (if (match-beginning 1) + (substring s (match-beginning 1) (match-end 1)) + s)) + +(defun doxymacs-find-next-func () + "Returns a list describing next function declaration, or nil if not found. + +(cdr (assoc 'func (doxymacs-find-next-func))) is the function name (string). +(cdr (assoc 'args (doxymacs-find-next-func))) is a list of arguments. +(cdr (assoc 'return (doxymacs-find-next-func))) is the return type (string). + +The argument list is a list of strings." + (interactive) + (save-excursion + (if (re-search-forward + (concat + ;; return type + "\\(\\(const[ \t\n]+\\)?[a-zA-Z0-9_]+[ \t\n*&]+\\)?" + + ;; name + "\\(\\([a-zA-Z0-9_~:<,>*&]\\|\\([ \t\n]+::[ \t\n]+\\)\\)+" + "\\(o?perator[ \t\n]*.[^(]*\\)?\\)[ \t\n]*(" + ) nil t) + + (let* ((func (buffer-substring (match-beginning 3) (match-end 3))) + (args (buffer-substring (point) (progn + (backward-char 1) + (forward-list) + (backward-char 1) + (point)))) + (ret (cond + ;; Return type specified + ((ma... [truncated message content] |
From: <suc...@us...> - 2006-08-12 21:27:26
|
Revision: 184 Author: sucknblow Date: 2006-08-12 14:27:22 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=184&view=rev Log Message: ----------- Fix CSS stylesheet for Doxygen 1.4.7 Modified Paths: -------------- trunk/pmplib/doc/Doxyfile trunk/pmplib/doc/pmplib-api.css Modified: trunk/pmplib/doc/Doxyfile =================================================================== --- trunk/pmplib/doc/Doxyfile 2006-08-12 18:46:14 UTC (rev 183) +++ trunk/pmplib/doc/Doxyfile 2006-08-12 21:27:22 UTC (rev 184) @@ -203,7 +203,7 @@ # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = -GENERATE_TAGFILE = +GENERATE_TAGFILE = pmplib.xml ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl Modified: trunk/pmplib/doc/pmplib-api.css =================================================================== --- trunk/pmplib/doc/pmplib-api.css 2006-08-12 18:46:14 UTC (rev 183) +++ trunk/pmplib/doc/pmplib-api.css 2006-08-12 21:27:22 UTC (rev 184) @@ -285,3 +285,65 @@ border-top: 1px solid black; } +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #FAFAFA; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-12 18:47:11
|
Revision: 183 Author: sucknblow Date: 2006-08-12 11:46:14 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=183&view=rev Log Message: ----------- First cut at generating API docs. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/cui/option.h trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/cui/util.h trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c trunk/pmplib/frontend/easypmp/win32gui/maindlg.h trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/include/gmi.h trunk/pmplib/include/ucs2char.h trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/webpage/1024px.css trunk/webpage/easypmp.html trunk/webpage/pmplib.xsl Added Paths: ----------- trunk/pmplib/doc/Doxyfile trunk/pmplib/doc/pmplib-api.css trunk/pmplib/doc/pmplib-foot.html trunk/pmplib/doc/pmplib-head.html trunk/pmplib/frontend/easypmp/common/Mainpage.dox trunk/pmplib/frontend/easypmp/cui/Mainpage.dox trunk/pmplib/frontend/easypmp/win32gui/Mainpage.dox trunk/pmplib/lib/gmi/Mainpage.dox trunk/pmplib/lib/ucs2/Mainpage.dox trunk/webpage/common.css Added: trunk/pmplib/doc/Doxyfile =================================================================== --- trunk/pmplib/doc/Doxyfile (rev 0) +++ trunk/pmplib/doc/Doxyfile 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,239 @@ +# Doxyfile 1.4.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = PMPlib API +PROJECT_NUMBER = 0.12 +OUTPUT_DIRECTORY = apidox +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = .. +FILE_PATTERNS = *.c \ + *.cpp \ + *.h \ + *.dox +RECURSIVE = YES +EXCLUDE = ../libltdl \ + ../lib/gmi/contrib \ + ../lib/playlist/contrib \ + ../frontend/easypmp/win32gui/resource.h +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = */frontend/easypmp/win32gui/stdafx.* +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = pmplib-head.html +HTML_FOOTER = pmplib-foot.html +HTML_STYLESHEET = pmplib-api.css +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO Added: trunk/pmplib/doc/pmplib-api.css =================================================================== --- trunk/pmplib/doc/pmplib-api.css (rev 0) +++ trunk/pmplib/doc/pmplib-api.css 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,287 @@ +h1{ +font-size:2.2em; +letter-spacing:-2px; +margin:0 0 30px 25px; +color:#4088b8; +} +CAPTION { font-weight: bold } +DIV.qindex { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +.fragment { + font-family: Fixed, monospace; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #F4F4FB; font-weight: bold; } +TD.mdPrefix { + background-color: #F4F4FB; + color: #606060; + font-size: 80%; +} +TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; } +TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; } +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; + width: 100%; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + Added: trunk/pmplib/doc/pmplib-foot.html =================================================================== --- trunk/pmplib/doc/pmplib-foot.html (rev 0) +++ trunk/pmplib/doc/pmplib-foot.html 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,8 @@ +</div> +<div id="footer"> +<p>Generated by Doxygen $doxygenversion on $datetime.</p> +<p>Copyright 2005-2006 PMPlib Project</p> +</div> +</div> +</body> +</html> Added: trunk/pmplib/doc/pmplib-head.html =================================================================== --- trunk/pmplib/doc/pmplib-head.html (rev 0) +++ trunk/pmplib/doc/pmplib-head.html 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,55 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>pmplib: Cui</title> +<link href="../../common.css" rel="stylesheet" type="text/css"> +<link href="pmplib-api.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> + +<div id="wrap"> + +<div id="header"> +<p id="toplinks">Skip to: <a href="#content">Content</a> | <a href="#sidebar">Navigation</a> | <a href="#footer">Footer</a></p> +<h1><a href="index.html">PMP<span class="fade">lib</span> API</a></h1> +</div> + + +<div id="sidebar"> +<p><a href="../../index.html">[PMP<span + class="fade">lib</span> Homepage]</a></p> + +<h2>Overview:</h2> +<ul> +<li><a href="index.html">Main page</a></li> +<li><a href="modules.html">Modules</a></li> +<li><a href="files.html">Files</a></li> +</ul> +<h2>Global Namespace:</h2> +<ul> +<li><a href="globals.html">All</a></li> +<ul> +<li><a href="globals_func.html">Functions</a></li> +<li><a href="globals_vars.html">Global variables</a></li> +<li><a href="globals_eval.html">Enumeration Constants</a></li> +<li><a href="globals_enum.html">Enumeration Values</a></li> +<li><a href="globals_type.html">Typedefs</a></li> +<li><a href="globals_defs.html">Preprocessor Definitions</a></li> +</ul> +</ul> + +<h2>Structs and Classes:</h2> +<ul> +<li><a href="annotated.html">Structs and Classes</a></li> +<li><a href="functions.html">All members</a></li> +<ul> +<li><a href="functions_vars.html">Fields/Members</a></li> +<li><a href="functions_func.html">Functions/Methods</a></li> +<li><a href="functions_type.html">Typedefs</a></li> +<li><a href="functions_eval.html">Enumeration Constants</a></li> +</ul> +</ul> +<!-- hierarchy.html --> + +</div> +<div id="content"> + Added: trunk/pmplib/frontend/easypmp/common/Mainpage.dox =================================================================== --- trunk/pmplib/frontend/easypmp/common/Mainpage.dox (rev 0) +++ trunk/pmplib/frontend/easypmp/common/Mainpage.dox 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,4 @@ +/** + * \defgroup common Support libraries for the EasyPMP programs. + * This module provides the command line interface for EasyPMP. + */ Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/common/database.c 2006-08-12 18:46:14 UTC (rev 183) @@ -39,6 +39,11 @@ #include <gmi.h> #include <easypmp.h> +/** + * \addtogroup common + * @{ + */ + #ifdef _WIN32 #define COMP_STR(x, y) lstrcmpiW(x, y) /* FAT32 treats upper/lower letters as identical. */ #else @@ -441,3 +446,4 @@ return 0; } +/** @} */ Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2006-08-12 18:46:14 UTC (rev 183) @@ -30,6 +30,11 @@ extern "C" { #endif/*__cplusplus*/ +/** + * \addtogroup common + * @{ + */ + enum { EASYPMPDBP_START = 0x00010000, EASYPMPDBP_READ = 0x00020000, @@ -178,6 +183,7 @@ easypmp_filelist_t* fl ); +/** @} */ #ifdef __cplusplus } Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2006-08-12 18:46:14 UTC (rev 183) @@ -39,6 +39,11 @@ #include <easypmp.h> +/** + * \addtogroup common + * @{ + */ + typedef struct { const option_t* opt; easypmp_filelist_t* fl; @@ -205,3 +210,5 @@ free(fl->elements); memset(fl, 0, sizeof(*fl)); } + +/** @} */ Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2006-08-12 18:46:14 UTC (rev 183) @@ -36,6 +36,11 @@ #include <easypmp.h> +/** + * \addtogroup common + * @{ + */ + typedef struct { void *instance; easypmp_progress_t progress; @@ -260,3 +265,5 @@ } return result; } +/** @} */ + Added: trunk/pmplib/frontend/easypmp/cui/Mainpage.dox =================================================================== --- trunk/pmplib/frontend/easypmp/cui/Mainpage.dox (rev 0) +++ trunk/pmplib/frontend/easypmp/cui/Mainpage.dox 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,4 @@ +/** + * \defgroup cui EasyPMP - Command line program. + * This module provides the command line interface for EasyPMP. + */ Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2006-08-12 18:46:14 UTC (rev 183) @@ -36,6 +36,11 @@ #include "util.h" +/** + * \addtogroup cui + * @{ + */ + static void device_show_pathflag(int flag, FILE* fp) { if (flag & PMPPEF_RECURSIVE) { @@ -84,3 +89,4 @@ { pmphelp_enumerate_devid(pmphelp, enumerate_devid_callback, pmphelp); } +/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-12 18:46:14 UTC (rev 183) @@ -51,6 +51,11 @@ #include <windows.h> #endif +/** + * \addtogroup cui + * @{ + */ + #define APPLICATION_S "EasyPMP [CUI]" #define VERSION_S "0.12 alpha" #define COPYRIGHT_S "Copyright (c) 2005-2006 Nyaochi" @@ -390,3 +395,4 @@ option_finish(&opt); return ret; } +/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2006-08-12 18:46:14 UTC (rev 183) @@ -55,6 +55,11 @@ #include <easypmp.h> #include "option.h" +/** + * \addtogroup cui + * @{ + */ + void option_usage(FILE *fp, const char *argv0) { fprintf(fp, "USAGE: %s [OPTIONS] [LOCATION]\n", argv0); @@ -263,3 +268,4 @@ return optind; } +/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/option.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/option.h 2006-08-12 18:46:14 UTC (rev 183) @@ -25,9 +25,16 @@ #ifndef __OPTION_H__ #define __OPTION_H__ +/** + * \addtogroup cui + * @{ + */ + void option_init(option_t* opt); void option_finish(option_t* opt); int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe); void option_usage(FILE *fp, const char *argv0); +/** @} */ + #endif/*__OPTION_H__*/ Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-12 18:46:14 UTC (rev 183) @@ -42,9 +42,13 @@ #include "util.h" +/** + * \addtogroup cui + * @{ + */ #if CAN_GET_WIN_SIZE -/* +/** The number of characters that can be printed on a single line, without causing a line wrap. Since the right-most column is required for the cursor, this is one less than the actual terminal @@ -58,7 +62,7 @@ static const unsigned short int window_width = 79; #endif -/* +/** The minimum width of the terminal we're willing to entertain. If the terminal gets narrower than this width, we treat it as this width. Note that it must be at least 2 to allow for one character and the @@ -67,7 +71,7 @@ static const int min_term_width = 6; -/* +/** Flags to indicate whether stdin, stdout, and stderr are attached to a terminal. These are used to determine whether we should check the width of some progress lines before printing them. Initialised in @@ -77,7 +81,7 @@ static int fd_is_tty[POSSIBLE_TTYS+1]; #if CAN_GET_WIN_SIZE -/* +/** Hander for the "terminal window changed size" signal. */ void window_size_changed(int unused) @@ -106,7 +110,7 @@ #endif/*CAN_GET_WIN_SIZE*/ } -/* +/** Delete all text on the current line by overwriting it with spaces, and write a \r to return the cursor to the start of the line. */ @@ -121,7 +125,7 @@ } -/* +/** Display as much of a UCS-2 encoded string as will fit on a single line in the terminal, and returning the cursor to the start of the line. If the terminal is less that the given minimum width, display @@ -170,12 +174,12 @@ } } -/* +/** Generic display method for progress messages consisting of a number and a string. - n - number to be shown in the numeric part - msg - message + @param n number to be shown in the numeric part + @param msg message */ int easypmp_progress_num_str( @@ -231,10 +235,4 @@ } } -/* - * Local Variables: - * indent-tabs-mode: t - * tab-width: 8 - * c-basic-offset: 8 - * End: - */ +/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/util.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-12 18:46:14 UTC (rev 183) @@ -25,10 +25,17 @@ #ifndef __UTIL_H__ #define __UTIL_H__ +/** + * \addtogroup cui + * @{ + */ + void display_init(); void clear_line(FILE *fp); void fprints(FILE *fp, const char *format, const ucs2char_t* value); void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length); +/** @} */ + #endif/*__UTIL_H__*/ Added: trunk/pmplib/frontend/easypmp/win32gui/Mainpage.dox =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/Mainpage.dox (rev 0) +++ trunk/pmplib/frontend/easypmp/win32gui/Mainpage.dox 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,4 @@ +/** + * \defgroup win32 EasyPMP - Windows GUI program. + * This module provides the Windows GUI for EasyPMP. + */ Modified: trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h 2006-08-12 18:46:14 UTC (rev 183) @@ -29,12 +29,18 @@ extern "C" { #endif/*__cplusplus*/ +/** + * \addtogroup win32 + * @{ + */ typedef void ejectdevice_t; ejectdevice_t* ejectdevice_init(void); void ejectdevice_finish(ejectdevice_t* ed); int ejectdevice_eject(ejectdevice_t* ed, const char *mount_point); +/** @} */ + #ifdef __cplusplus } #endif/*__cplusplus*/ Modified: trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c 2006-08-12 18:46:14 UTC (rev 183) @@ -25,6 +25,10 @@ #include <windows.h> #include "ejectdevice.h" +/** + * \addtogroup win32 + * @{ + */ typedef DWORD DEVINST, *PDEVINST; typedef DWORD CONFIGRET; typedef LPCSTR DEVINSTID; @@ -328,3 +332,5 @@ return 2; } } + +/** @} */ Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2006-08-12 18:46:14 UTC (rev 183) @@ -24,6 +24,10 @@ #pragma once +/** + * \addtogroup win32 + * @{ + */ class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>, @@ -350,3 +354,5 @@ m_strIniFile = strIniFile; } }; +/** @} */ + Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2006-08-12 18:46:14 UTC (rev 183) @@ -24,6 +24,10 @@ #pragma once +/** + * \addtogroup win32 + * @{ + */ class CEasyPMPSetting { public: int iDBProces; @@ -324,3 +328,4 @@ } }; +/** @} */ Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2006-08-12 18:46:14 UTC (rev 183) @@ -40,6 +40,10 @@ #include "processingdlg.h" #include "maindlg.h" +/** + * \addtogroup win32 + * @{ + */ CAppModule _Module; int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) @@ -86,3 +90,4 @@ return nRet; } +/** @} */ Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/include/gmi.h 2006-08-12 18:46:14 UTC (rev 183) @@ -37,6 +37,11 @@ #include <pmp.h> +/** + * \addtogroup gmi + * @{ + */ + enum { GMIF_NONE = 0x00000000, GMIF_TAG = 0x00000001, @@ -61,6 +66,8 @@ int num_strip_words ); +/** @} */ + #ifdef __cplusplus } #endif/*__cplusplus*/ Modified: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/include/ucs2char.h 2006-08-12 18:46:14 UTC (rev 183) @@ -37,6 +37,11 @@ extern "C" { #endif/*__cplusplus*/ +/** + * \addtogroup ucs2 + * @{ + */ + typedef uint16_t ucs2char_t; struct tag_ucs2conv { @@ -120,6 +125,7 @@ UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode); +/** @} */ #ifdef __cplusplus } Added: trunk/pmplib/lib/gmi/Mainpage.dox =================================================================== --- trunk/pmplib/lib/gmi/Mainpage.dox (rev 0) +++ trunk/pmplib/lib/gmi/Mainpage.dox 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,5 @@ +/** + * \defgroup gmi Media file tag reading library (gmi) + * + * This module provides functions for reading tags from media files. + */ Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/gmi/gmi.c 2006-08-12 18:46:14 UTC (rev 183) @@ -1,3 +1,4 @@ + /* * Common routines for tag and audio information retrieval. * @@ -31,6 +32,11 @@ #include <filepath.h> #include <gmi.h> +/** + * \addtogroup gmi + * @{ + */ + int gmi_mp3(media_info_t* info, const ucs2char_t *filename); static const ucs2char_t ucs2cs_ext_mp3[] = {'.','m','p','3',0}; @@ -256,3 +262,4 @@ return ret; } +/** @} */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2006-08-12 18:46:14 UTC (rev 183) @@ -38,6 +38,11 @@ #include <id3tag.h> +/** + * \addtogroup gmi + * @{ + */ + struct tag_mp3header { int version; /**< MPEG version */ int protection; /**< true if the frame is protected by CRC */ @@ -486,3 +491,5 @@ info->codec = PMPCODEC_MPEGLAYER3; return 0; } + +/** @} */ Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2006-08-12 18:46:14 UTC (rev 183) @@ -37,6 +37,11 @@ #include <vorbis/codec.h> #include <vorbis/vorbisfile.h> +/** + * \addtogroup gmi + * @{ + */ + #ifdef WIN32 #define strncasecmp strnicmp #endif @@ -124,3 +129,5 @@ } return -1; } + +/** @} */ Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2006-08-12 18:46:14 UTC (rev 183) @@ -1,3 +1,4 @@ + /* * Tag and audio information retrieval from Riff/WAVE files. * @@ -34,6 +35,11 @@ #include <ucs2char.h> #include <gmi.h> +/** + * \addtogroup gmi + * @{ + */ + #define MIN(a, b) ((a) < (b) ? (a) : (b)) struct tag_chunk_header { @@ -258,3 +264,5 @@ } return ret; } + +/** @} */ Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2006-08-12 18:46:14 UTC (rev 183) @@ -34,6 +34,11 @@ #include <ucs2char.h> #include <gmi.h> +/** + * \addtogroup gmi + * @{ + */ + typedef unsigned char guid_t[16]; static guid_t g_guid_header_object = @@ -512,3 +517,5 @@ } return ret; } + +/** @} */ Added: trunk/pmplib/lib/ucs2/Mainpage.dox =================================================================== --- trunk/pmplib/lib/ucs2/Mainpage.dox (rev 0) +++ trunk/pmplib/lib/ucs2/Mainpage.dox 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,6 @@ +/** + * \defgroup ucs2 UCS-2 string library + * + * This module provides functions for working with UCS-2 encoded + * strings. + */ Modified: trunk/pmplib/lib/ucs2/ucs2char.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/ucs2/ucs2char.c 2006-08-12 18:46:14 UTC (rev 183) @@ -31,6 +31,11 @@ #include <string.h> #include <ucs2char.h> +/** + * \addtogroup ucs2 + * @{ + */ + #define COMP(a, b) ((a)>(b))-((a)<(b)) @@ -434,4 +439,6 @@ return ucs2righttoleft_encode(str); } +/** @} */ + #endif Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2006-08-12 18:46:14 UTC (rev 183) @@ -39,6 +39,11 @@ #include <iconv.h> +/** + * \addtogroup ucs2 + * @{ + */ + #ifdef USE_LIBICONV_GNU #define iconv_open libiconv_open #define iconv_convert libiconv_convert @@ -320,3 +325,5 @@ } return 0; } + +/** @} */ Modified: trunk/webpage/1024px.css =================================================================== --- trunk/webpage/1024px.css 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/webpage/1024px.css 2006-08-12 18:46:14 UTC (rev 183) @@ -1,216 +1,57 @@ -/* 1024px - An open source xhtml/css website template by Andreas Viklund - http://andreasviklund.com . Free to use in any way and for any purpose as long as the proper credits are given to the original designer. - -Version: 1.2, April 20, 2006 */ - -/******** General tags ********/ -body{ - font:76% Verdana,Tahoma,Arial,sans-serif; - background:#ffffff url(images/background.gif) top center repeat-y; - color:#404040; - line-height:1.2em; - margin:0 auto; - padding:0; -} - -a{ - text-decoration:none; - color:#4088b8; -} - -a img{ - border:0; -} - -p { - margin:0 0 10px 10px; -} - -img { - margin: 0 0 10px 10px; -} -ul ol dl { - margin: 2px 0 16px 16px; -} -ul ul,ol ol { - margin:4px 0 4px 16px; -} - -h1{ -font-size:4.2em; -letter-spacing:-5px; -margin:0 0 30px 25px; -color:#4088b8; -} - -h1 a{text-transform:none; color:#4088b8;} - -h2{ -font-size:1.4em; -color:#4088b8; -border-bottom:4px solid #dadada; -padding:0 2px 2px 5px; -margin:0 0 10px 0; -letter-spacing:-1px; -} - -h3{ -font-size:1.2em; -font-weight:bold; -color:#4088b8; -border-bottom:1px solid #dadada; -margin:10px 0 8px 0; -padding:1px 2px 2px 3px; -} - -blockquote{ -font-size:0.9em; -border:1px solid #dadada; -margin:20px 10px; -padding:8px; -} - -/******** Main wrap ********/ -#wrap{ -color:#404040; -width:970px; -margin:10px auto; -padding:0; -} - -#header{margin:0;} - -#toplinks{text-align:right; padding:5px 2px 2px 3px;} - -#slogan{ -font-size:1.5em; -color:#808080; -font-weight:bold; -letter-spacing:-1px; -margin:15px 0px 20px 35px; -line-height:1.2em; -} - -/******** sidebar ********/ -#sidebar{ -float:left; -width:195px; -margin:0 0 5px 0; -padding:1px 0 0 0; -} - -#sidebar ul{ -list-style:none; -font-size:0.9em; -margin:0; -padding:0 0 15px 10px; -} - -#sidebar li{ -list-style:none; -margin:0 0 4px 0; -padding:0; -} - -#sidebar li a{ -font-size:1.2em; -font-weight:bold; -padding:2px; -} - -#sidebar ul ul{ -margin:4px 0 3px 15px; -line-height:1.2em; -padding:0; -} - -#sidebar ul ul li a{font-weight:normal;} -#sidebar h2{margin:3px 0px 8px 0px;} - -/******** Content variations ********/ -#content{ -line-height:1.5em; -width:750px; -float:right; -text-align:left; -margin:0; -padding:0; -} - -#contentalt{ -line-height:1.5em; -width:750px; -float:left; -text-align:left; -padding:0; -margin-right:20px; -} - -#content h3, #contentalt h3{margin:10px 0 8px;} - -/******** Footer ********/ -#footer{ -clear:both; -text-align:right; -color:#808080; -font-size:0.9em; -border-top:4px solid #dadada; -margin:0 auto; -padding:8px 0; -line-height:1.6em; -} - -#footer p{margin:0; padding:0;} -#footer a{color:#808080;} - -/******** Various classes ********/ -.box{ -color:#ffffff; -font-size:0.9em; -background-color:#4088b8; -border:1px solid #c8c8c8; -line-height:1.3em; -padding:5px 5px 5px 8px; -} - -.box a{color:#f0f0f0;} -.left{float:left; margin:0 15px 4px 0;} -.right{float:right; margin:0 0 4px 15px;} -.textright{text-align:right;} -.readmore{text-align:right; margin:-10px 10px 12px 0;} - -.center{text-align:center;} -.blue{color:#4088b8;} -.big{font-size:1.3em;} -.small{font-size:0.8em;} -.bold{font-weight:bold;} - -.clear{clear:both;} -.hide{display:none;} -.fade{color:#c8c8c8;} -.gray{color:#808080;} - -.photo{ -border:1px solid #bababa; -padding:2px; -background-color:#ffffff; -margin:6px 18px 2px 5px; -} - -table { - margin: 8px; -} - -code { - font: 1em 'Courier New', Courier, monospace; - color: #444; - white-space: pre; - width: 640px; - height: auto; - overflow: auto; - display: block; - border: 1px solid #999; - border-width: 2px 0; - padding: 1em; - margin: 0 0 1em 48px; - background-color: #fafafa; -} +/* 1024px - An open source xhtml/css website template by Andreas Viklund - http://andreasviklund.com . Free to use in any way and for any purpose as long as the proper credits are given to the original designer. + +Version: 1.2, April 20, 2006 */ + +@import 'common.css'; + +/******** Various classes ********/ +.box{ +color:#ffffff; +font-size:0.9em; +background-color:#4088b8; +border:1px solid #c8c8c8; +line-height:1.3em; +padding:5px 5px 5px 8px; +} + +.box a{color:#f0f0f0;} +.left{float:left; margin:0 15px 4px 0;} +.right{float:right; margin:0 0 4px 15px;} +.textright{text-align:right;} +.readmore{text-align:right; margin:-10px 10px 12px 0;} + +.center{text-align:center;} +.blue{color:#4088b8;} +.big{font-size:1.3em;} +.small{font-size:0.8em;} +.bold{font-weight:bold;} + +.clear{clear:both;} +.hide{display:none;} +.gray{color:#808080;} + +.photo{ +border:1px solid #bababa; +padding:2px; +background-color:#ffffff; +margin:6px 18px 2px 5px; +} + +table { + margin: 8px; +} + +code { + font: 1em 'Courier New', Courier, monospace; + color: #444; + white-space: pre; + width: 640px; + height: auto; + overflow: auto; + display: block; + border: 1px solid #999; + border-width: 2px 0; + padding: 1em; + margin: 0 0 1em 48px; + background-color: #fafafa; +} Copied: trunk/webpage/common.css (from rev 182, trunk/webpage/1024px.css) =================================================================== --- trunk/webpage/common.css (rev 0) +++ trunk/webpage/common.css 2006-08-12 18:46:14 UTC (rev 183) @@ -0,0 +1,160 @@ +/******** General tags ********/ +body{ + font:76% Verdana,Tahoma,Arial,sans-serif; + background:#ffffff url(images/background.gif) top center repeat-y; + color:#404040; + line-height:1.2em; + margin:0 auto; + padding:0; +} + +a{ + text-decoration:none; + color:#4088b8; +} + +a img{ + border:0; +} + +p { + margin:0 0 10px 10px; +} + +img { + margin: 0 0 10px 10px; +} +ul ol dl { + margin: 2px 0 16px 16px; +} +ul ul,ol ol { + margin:4px 0 4px 16px; +} + +h1{ +font-size:4.2em; +letter-spacing:-5px; +margin:0 0 30px 25px; +color:#4088b8; +} + +h1 a{text-transform:none; color:#4088b8;} + +h2{ +font-size:1.4em; +color:#4088b8; +border-bottom:4px solid #dadada; +padding:0 2px 2px 5px; +margin:0 0 10px 0; +letter-spacing:-1px; +} + +h3{ +font-size:1.2em; +font-weight:bold; +color:#4088b8; +border-bottom:1px solid #dadada; +margin:10px 0 8px 0; +padding:1px 2px 2px 3px; +} + +blockquote{ +font-size:0.9em; +border:1px solid #dadada; +margin:20px 10px; +padding:8px; +} + +/******** Main wrap ********/ +#wrap{ +color:#404040; +width:970px; +margin:10px auto; +padding:0; +} + +#header{margin:0;} +.fade{color:#c8c8c8;} + +#toplinks{text-align:right; padding:5px 2px 2px 3px;} + +#slogan{ +font-size:1.5em; +color:#808080; +font-weight:bold; +letter-spacing:-1px; +margin:15px 0px 20px 35px; +line-height:1.2em; +} + +/******** sidebar ********/ +#sidebar{ +float:left; +width:195px; +margin:0 0 5px 0; +padding:1px 0 0 0; +} + +#sidebar ul{ +list-style:none; +font-size:0.9em; +margin:0; +padding:0 0 15px 10px; +} + +#sidebar li{ +list-style:none; +margin:0 0 4px 0; +padding:0; +} + +#sidebar li a{ +font-size:1.2em; +font-weight:bold; +padding:2px; +} + +#sidebar ul ul{ +margin:4px 0 3px 15px; +line-height:1.2em; +padding:0; +} + +#sidebar ul ul li a{font-weight:normal;} +#sidebar h2{margin:3px 0px 8px 0px;} + +/******** Content variations ********/ +#content{ +line-height:1.5em; +width:750px; +float:right; +text-align:left; +margin:0; +padding:0; +} + +#contentalt{ +line-height:1.5em; +width:750px; +float:left; +text-align:left; +padding:0; +margin-right:20px; +} + +#content h3, #contentalt h3{margin:10px 0 8px;} +/******** Footer ********/ +#footer{ +clear:both; +text-align:right; +color:#808080; +font-size:0.9em; +border-top:4px solid #dadada; +margin:0 auto; +padding:8px 0; +line-height:1.6em; +} + +#footer p{margin:0; padding:0;} +#footer a{color:#808080;} + Modified: trunk/webpage/easypmp.html =================================================================== --- trunk/webpage/easypmp.html 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/webpage/easypmp.html 2006-08-12 18:46:14 UTC (rev 183) @@ -215,4 +215,4 @@ POSIX port using the Cygwin environment. <p>This manual page was written by Martin Ellis , who also contributed bug fixes for the POSIX port.</p> -Time: 20:13:34 GMT, July 29, 2006 +Time: 18:04:26 GMT, August 12, 2006 Modified: trunk/webpage/pmplib.xsl =================================================================== --- trunk/webpage/pmplib.xsl 2006-08-10 01:05:15 UTC (rev 182) +++ trunk/webpage/pmplib.xsl 2006-08-12 18:46:14 UTC (rev 183) @@ -299,6 +299,7 @@ <li><a href="document_jspl.html">JavaScript Playlist (JSPL)</a></li> </ul> </li> + <li><a href="apidox/html/index.html">API Documentation</a></li> <li><a href="http://sourceforge.net/forum/?group_id=157298">Forum</a></li> <!--<li><a href="faq.html">FAQ</a></li>--> <li><a href="about.html">About</a></li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-10 01:05:22
|
Revision: 182 Author: sucknblow Date: 2006-08-09 18:05:15 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=182&view=rev Log Message: ----------- Tagging script for releases. Added Paths: ----------- trunk/scripts/release/ trunk/scripts/release/make_tag Added: trunk/scripts/release/make_tag =================================================================== --- trunk/scripts/release/make_tag (rev 0) +++ trunk/scripts/release/make_tag 2006-08-10 01:05:15 UTC (rev 182) @@ -0,0 +1,77 @@ +#!/bin/sh + +usage() +{ +cat<<EOF +Usage: $0 [--no-checks] x.yz + where x.yz is a numeric version number. +EOF +} + +while test "$#" -gt 1 ; do + case "$1" in + --no-checks) + no_checks=yes + ;; + *) + echo "Unrecognised option: $1" + usage + exit + ;; + esac + shift +done + +if test "$#" -eq 1 ; then + VERSION=$1 +else + echo "No version number specified" + usage + exit +fi + +TAGDIR=tagging.$$ +svn co -N https://svn.sourceforge.net/svnroot/pmplib/ $TAGDIR +cd $TAGDIR +svn up -N {trunk,tags} +svn up -N tags/pmplib +svn up trunk/pmplib + +if test "$no_checks" != "yes" ; then + RELEASE_DATE=`sed "/Changes in $VERSION/ \ + {s/.*(\([0-9]\{4\}.[0-9]\{1,2\}.[0-9]\{1,2\}\).*/\1/;p};d" \ + trunk/pmplib/ChangeLog` + if test -z "$RELEASE_DATE" ; then + echo First set a release date in the ChangeLog! + exit + elif test -z "$(date -d "$RELEASE_DATE")" ; then + echo in the ChangeLog + else + echo Release date: $RELEASE_DATE + fi +fi + +if test "$no_checks" != "yes" ; then + CHECK_AUTOTOOLS_VER=$(grep -c "AM_INIT_AUTOMAKE(pmplib, \+$VERSION)" trunk/pmplib/configure.in) + if test "$CHECK_AUTOTOOLS_VER" -ne 1 ; then + echo Update version in configure.in! + exit + fi +fi + +if test "$no_checks" != "yes" ; then + svn up -N tags/pmplib/$VERSION + if test -d tags/pmplib/$VERSION ; then + echo Tag directory already exists for this version! + exit + fi +fi + +svn mkdir tags/pmplib/$VERSION +svn cp trunk/pmplib tags/pmplib/$VERSION/pmplib +svn rm tags/pmplib/$VERSION/pmplib/debian +svn cp trunk/pmplib/debian tags/pmplib/$VERSION/debian +cd .. + +echo +echo " * Now commit in $TAGDIR/tags" Property changes on: trunk/scripts/release/make_tag ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-10 00:19:51
|
Revision: 181 Author: sucknblow Date: 2006-08-09 17:19:45 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=181&view=rev Log Message: ----------- Scripts for setting up emacs for pmplib codebase. Added Paths: ----------- trunk/scripts/ trunk/scripts/emacs/ trunk/scripts/emacs/javascript.el trunk/scripts/emacs/pmp-emacs.el Added: trunk/scripts/emacs/javascript.el =================================================================== --- trunk/scripts/emacs/javascript.el (rev 0) +++ trunk/scripts/emacs/javascript.el 2006-08-10 00:19:45 UTC (rev 181) @@ -0,0 +1,641 @@ +;;; javascript.el --- Major mode for editing JavaScript source text + +;; Copyright (C) 2006 Karl Landström + +;; Author: Karl Landström <kl...@co...> +;; Maintainer: Karl Landström <kl...@co...> +;; Version: 2.0 Beta 6 +;; Date: 2006-07-31 +;; Keywords: languages, oop + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; The main features of this JavaScript mode are syntactic +;; highlighting (enabled with `font-lock-mode' or +;; `global-font-lock-mode'), automatic indentation and filling of +;; comments. +;; +;; This package has (only) been tested with GNU Emacs 21.4 (the latest +;; stable release). +;; +;; Installation: +;; +;; Put this file in a directory where Emacs can find it (`C-h v +;; load-path' for more info). Then add the following lines to your +;; Emacs initialization file: +;; +;; (add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode)) +;; (autoload 'javascript-mode "javascript" nil t) +;; +;; General Remarks: +;; +;; This mode assumes that block comments are not nested inside block +;; comments and that strings do not contain line breaks. +;; +;; Exported names start with "javascript-" whereas private names start +;; with "js-". +;; +;; Changes: +;; +;; See javascript.el.changelog. + +;;; Code: + +(require 'cc-mode) +(require 'font-lock) +(require 'newcomment) + +(defgroup javascript nil + "Customization variables for `javascript-mode'." + :group 'languages) + +(defcustom javascript-indent-level 3 + "Number of spaces for each indentation step." + :type 'integer + :group 'javascript) + +(defcustom javascript-auto-indent-flag t + "Automatic indentation with punctuation characters. If non-nil, the +current line is indented when certain punctuations are inserted." + :type 'boolean + :group 'javascript) + + +;; --- Keymap --- + +(defvar javascript-mode-map nil + "Keymap used in JavaScript mode.") + +(unless javascript-mode-map + (setq javascript-mode-map (make-sparse-keymap))) + +(when javascript-auto-indent-flag + (mapc (lambda (key) + (define-key javascript-mode-map key 'javascript-insert-and-indent)) + '("{" "}" "(" ")" ":" ";" ","))) + +(defun javascript-insert-and-indent (key) + "Run command bound to key and indent current line. Runs the command +bound to KEY in the global keymap and indents the current line." + (interactive (list (this-command-keys))) + (call-interactively (lookup-key (current-global-map) key)) + (indent-according-to-mode)) + + +;; --- Syntax Table And Parsing --- + +(defvar javascript-mode-syntax-table + (let ((table (make-syntax-table))) + (c-populate-syntax-table table) + + ;; The syntax class of underscore should really be `symbol' ("_") + ;; but that makes matching of tokens much more complex as e.g. + ;; "\\<xyz\\>" matches part of e.g. "_xyz" and "xyz_abc". Defines + ;; it as word constituent for now. + (modify-syntax-entry ?_ "w" table) + + table) + "Syntax table used in JavaScript mode.") + + +(defun js-re-search-forward-inner (regexp &optional bound count) + "Auxiliary function for `js-re-search-forward'." + (let ((parse) + (saved-point (point-min))) + (while (> count 0) + (re-search-forward regexp bound) + (setq parse (parse-partial-sexp saved-point (point))) + (cond ((nth 3 parse) + (re-search-forward + (concat "\\([^\\]\\|^\\)" (string (nth 3 parse))) + (save-excursion (end-of-line) (point)) t)) + ((nth 7 parse) + (forward-line)) + ((or (nth 4 parse) + (and (eq (char-before) ?\/) (eq (char-after) ?\*))) + (re-search-forward "\\*/")) + (t + (setq count (1- count)))) + (setq saved-point (point)))) + (point)) + + +(defun js-re-search-forward (regexp &optional bound noerror count) + "Search forward but ignore strings and comments. Invokes +`re-search-forward' but treats the buffer as if strings and +comments have been removed." + (let ((saved-point (point)) + (search-expr + (cond ((null count) + '(js-re-search-forward-inner regexp bound 1)) + ((< count 0) + '(js-re-search-backward-inner regexp bound (- count))) + ((> count 0) + '(js-re-search-forward-inner regexp bound count))))) + (condition-case err + (eval search-expr) + (search-failed + (goto-char saved-point) + (unless noerror + (error (error-message-string err))))))) + + +(defun js-re-search-backward-inner (regexp &optional bound count) + "Auxiliary function for `js-re-search-backward'." + (let ((parse) + (saved-point (point-min))) + (while (> count 0) + (re-search-backward regexp bound) + (when (and (> (point) (point-min)) + (save-excursion (backward-char) (looking-at "/[/*]"))) + (forward-char)) + (setq parse (parse-partial-sexp saved-point (point))) + (cond ((nth 3 parse) + (re-search-backward + (concat "\\([^\\]\\|^\\)" (string (nth 3 parse))) + (save-excursion (beginning-of-line) (point)) t)) + ((nth 7 parse) + (goto-char (nth 8 parse))) + ((or (nth 4 parse) + (and (eq (char-before) ?/) (eq (char-after) ?*))) + (re-search-backward "/\\*")) + (t + (setq count (1- count)))))) + (point)) + + +(defun js-re-search-backward (regexp &optional bound noerror count) + "Search backward but ignore strings and comments. Invokes +`re-search-backward' but treats the buffer as if strings and +comments have been removed." + (let ((saved-point (point)) + (search-expr + (cond ((null count) + '(js-re-search-backward-inner regexp bound 1)) + ((< count 0) + '(js-re-search-forward-inner regexp bound (- count))) + ((> count 0) + '(js-re-search-backward-inner regexp bound count))))) + (condition-case err + (eval search-expr) + (search-failed + (goto-char saved-point) + (unless noerror + (error (error-message-string err))))))) + + +;; --- Font Lock --- + +(defconst js-function-heading-1-re + "^[ \t]*function[ \t]+\\(\\w+\\)" + "Regular expression matching the start of a function header.") + +(defconst js-function-heading-2-re + "^[ \t]*\\(\\w+\\)[ \t]*:[ \t]*function\\>" + "Regular expression matching the start of a function entry in + an associative array.") + +(defconst js-keyword-re + (regexp-opt '("abstract" "break" "case" "catch" "class" "const" + "continue" "debugger" "default" "delete" "do" "else" + "enum" "export" "extends" "final" "finally" "for" + "function" "goto" "if" "implements" "import" "in" + "instanceof" "interface" "native" "new" "package" + "private" "protected" "public" "return" "static" + "super" "switch" "synchronized" "this" "throw" + "throws" "transient" "try" "typeof" "var" "void" + "volatile" "while" "with") 'words) + "Regular expression matching any JavaScript keyword.") + +(defconst js-basic-type-re + (regexp-opt '("boolean" "byte" "char" "double" "float" "int" "long" + "short" "void") 'words) + "Regular expression matching any predefined type in JavaScript.") + +(defconst js-constant-re + (regexp-opt '("false" "null" "true") 'words) + "Regular expression matching any future reserved words in JavaScript.") + + +(defconst js-font-lock-keywords-1 + (list + "\\<import\\>" + (list js-function-heading-1-re 1 font-lock-function-name-face) + (list js-function-heading-2-re 1 font-lock-function-name-face) + (list "[[:punct:]][[:blank:]]*\\(/.*?/\\w*\\)" 1 font-lock-string-face)) + "Level one font lock.") + +(defconst js-font-lock-keywords-2 + (append js-font-lock-keywords-1 + (list (list js-keyword-re 1 font-lock-keyword-face) + (cons js-basic-type-re font-lock-type-face) + (cons js-constant-re font-lock-constant-face))) + "Level two font lock.") + +(defconst js-font-lock-keywords-3 + (append js-font-lock-keywords-2 + (list + (list + (concat "\\<\\(const\\|var\\)\\>\\|" js-basic-type-re "\\|" + js-function-heading-1-re "\\|" js-function-heading-2-re) + (list "\\(\\w+\\)[ \t]*\\(,\\|=[ \t]*\\(\".*?\"\\|'.*?'\\|{.*?}\\|.*?,\\)\\|.*\\)" + nil + nil + '(1 font-lock-variable-name-face))))) + "Level three font lock.") + +(defconst js-font-lock-keywords + '(js-font-lock-keywords-3 js-font-lock-keywords-1 js-font-lock-keywords-2 + js-font-lock-keywords-3) + "See `font-lock-keywords'.") + + +;; --- Indentation --- + +(defconst js-possibly-braceless-keyword-re + (regexp-opt + '("catch" "do" "else" "finally" "for" "if" "try" "while" "with") + 'words) + "Regular expression matching keywords that are optionally + followed by an opening brace.") + +(defconst js-indent-operator-re + (concat "[-+*/%<>=&^|?:]\\([^-+*/]\\|$\\)\\|" + (regexp-opt '("in" "instanceof") 'words)) + "Regular expression matching operators that affect indentation + of continued expressions.") + + +(defun js-looking-at-operator-p () + "Return non-nil if text after point is an operator (that is not +a comma)." + (save-match-data + (and (looking-at js-indent-operator-re) + (or (not (looking-at ":")) + (save-excursion + (and (js-re-search-backward "[?:{]\\|\\<case\\>" nil t) + (looking-at "?"))))))) + + +(defun js-continued-expression-p () + "Returns non-nil if the current line continues an expression." + (save-excursion + (back-to-indentation) + (or (js-looking-at-operator-p) + (and (js-re-search-backward "\n" nil t) + (progn + (skip-chars-backward " \t") + (backward-char) + (and (> (point) (point-min)) + (save-excursion (backward-char) (not (looking-at "[/*]/"))) + (js-looking-at-operator-p) + (and (progn (backward-char) + (not (looking-at "++\\|--\\|/[/*]")))))))))) + + +(defun js-end-of-do-while-loop-p () + "Returns non-nil if word after point is `while' of a do-while +statement, else returns nil. A braceless do-while statement +spanning several lines requires that the start of the loop is +indented to the same column as the current line." + (interactive) + (save-excursion + (save-match-data + (when (looking-at "\\s-*\\<while\\>") + (if (save-excursion + (skip-chars-backward "[ \t\n]*}") + (looking-at "[ \t\n]*}")) + (save-excursion + (backward-list) (backward-word 1) (looking-at "\\<do\\>")) + (js-re-search-backward "\\<do\\>" (point-at-bol) t) + (or (looking-at "\\<do\\>") + (let ((saved-indent (current-indentation))) + (while (and (js-re-search-backward "^[ \t]*\\<" nil t) + (/= (current-indentation) saved-indent))) + (and (looking-at "[ \t]*\\<do\\>") + (not (js-re-search-forward + "\\<while\\>" (point-at-eol) t)) + (= (current-indentation) saved-indent))))))))) + + +(defun js-ctrl-statement-indentation () + "Returns the proper indentation of the current line if it +starts the body of a control statement without braces, else +returns nil." + (save-excursion + (back-to-indentation) + (when (save-excursion + (and (> (count-lines (point-min) (point)) 1) + (not (looking-at "[{}]")) + (js-re-search-backward "[[:graph:]]" nil t) + (not (looking-at "[{([]")) + (progn + (forward-char) + (backward-sexp) + (when (looking-at "(") (backward-word 1)) + (and (save-excursion + (skip-chars-backward " \t}" (point-at-bol)) + (bolp)) + (looking-at js-possibly-braceless-keyword-re) + (not (js-end-of-do-while-loop-p)))))) + (save-excursion + (goto-char (match-beginning 0)) + (+ (current-indentation) javascript-indent-level))))) + + +(defun js-proper-indentation (parse-status) + "Return the proper indentation for the current line." + (save-excursion + (back-to-indentation) + (let ((ctrl-stmt-indent (js-ctrl-statement-indentation)) + (same-indent-p (looking-at "[]})]\\|\\<case\\>\\|\\<default\\>")) + (continued-expr-p (js-continued-expression-p))) + (cond (ctrl-stmt-indent) + ((nth 1 parse-status) + (goto-char (nth 1 parse-status)) + (if (looking-at "[({[][ \t]*\\(/[/*]\\|$\\)") + (let ((p (parse-partial-sexp (point-at-bol) (point)))) + (when (save-excursion (skip-chars-backward " \t)") + (looking-at ")")) + (backward-list)) + (if (nth 1 p) + (progn (goto-char (1+ (nth 1 p))) + (skip-chars-forward " \t")) + (back-to-indentation)) + (cond (same-indent-p + (current-column)) + (continued-expr-p + (+ (current-column) (* 2 javascript-indent-level))) + (t + (+ (current-column) javascript-indent-level)))) + (unless same-indent-p + (forward-char) + (skip-chars-forward " \t")) + (current-column))) + (continued-expr-p javascript-indent-level) + (t 0))))) + + +(defun javascript-indent-line () + "Indent the current line as JavaScript source text." + (interactive) + (let ((parse-status + (save-excursion (parse-partial-sexp (point-min) (point-at-bol)))) + (offset (- (current-column) (current-indentation)))) + (when (not (nth 8 parse-status)) + (indent-line-to (js-proper-indentation parse-status)) + (when (> offset 0) (forward-char offset))))) + + +;; --- Filling --- + +;; FIXME: It should be possible to use the more sofisticated function +;; `c-fill-paragraph' in `cc-cmds.el' instead. However, just setting +;; `fill-paragraph-function' to `c-fill-paragraph' does not work; +;; inside `c-fill-paragraph', `fill-paragraph-function' evaluates to +;; nil!? + +(defun js-backward-paragraph () + "Move backward to start of paragraph. Postcondition: Point is at +beginning of buffer or the previous line contains only whitespace." + (forward-line -1) + (while (not (or (bobp) (looking-at "^[ \t]*$"))) + (forward-line -1)) + (when (not (bobp)) (forward-line 1))) + + +(defun js-forward-paragraph () + "Move forward to end of paragraph. Postcondition: Point is at +end of buffer or the next line contains only whitespace." + (forward-line 1) + (while (not (or (eobp) (looking-at "^[ \t]*$"))) + (forward-line 1)) + (when (not (eobp)) (backward-char 1))) + + +(defun js-fill-block-comment-paragraph (parse-status justify) + "Fill current paragraph as a block comment. PARSE-STATUS is the +result of `parse-partial-regexp' from beginning of buffer to +point. JUSTIFY has the same meaning as in `fill-paragraph'." + (let ((offset (save-excursion + (goto-char (nth 8 parse-status)) (current-indentation)))) + (save-excursion + (save-restriction + (narrow-to-region (save-excursion + (goto-char (nth 8 parse-status)) (point-at-bol)) + (save-excursion + (goto-char (nth 8 parse-status)) + (re-search-forward "*/"))) + (narrow-to-region (save-excursion + (js-backward-paragraph) + (when (looking-at "^[ \t]*$") (forward-line 1)) + (point)) + (save-excursion + (js-forward-paragraph) + (when (looking-at "^[ \t]*$") (backward-char)) + (point))) + (goto-char (point-min)) + (while (not (eobp)) + (delete-horizontal-space) + (forward-line 1)) + (let ((fill-column (- fill-column offset)) + (fill-paragraph-function nil)) + (fill-paragraph justify)) + + ;; In Emacs 21.4 as opposed to CVS Emacs 22, + ;; `fill-paragraph' seems toadd a newline at the end of the + ;; paragraph. Remove it! + (goto-char (point-max)) + (when (looking-at "^$") (backward-delete-char 1)) + + (goto-char (point-min)) + (while (not (eobp)) + (indent-to offset) + (forward-line 1)))))) + + +(defun js-sline-comment-par-start () + "Return point at the beginning of the line where the current +single-line comment paragraph starts." + (save-excursion + (beginning-of-line) + (while (and (not (bobp)) + (looking-at "^[ \t]*//[ \t]*[[:graph:]]")) + (forward-line -1)) + (unless (bobp) (forward-line 1)) + (point))) + + +(defun js-sline-comment-par-end () + "Return point at end of current single-line comment paragraph." + (save-excursion + (beginning-of-line) + (while (and (not (eobp)) + (looking-at "^[ \t]*//[ \t]*[[:graph:]]")) + (forward-line 1)) + (unless (bobp) (backward-char)) + (point))) + + +(defun js-sline-comment-offset (line) + "Return the column at the start of the current single-line +comment paragraph." + (save-excursion + (goto-line line) + (re-search-forward "//" (point-at-eol)) + (goto-char (match-beginning 0)) + (current-column))) + + +(defun js-sline-comment-text-offset (line) + "Return the column at the start of the text of the current +single-line comment paragraph." + (save-excursion + (goto-line line) + (re-search-forward "//[ \t]*" (point-at-eol)) + (current-column))) + + +(defun js-at-empty-sline-comment-p () + "Return non-nil if inside an empty single-line comment." + (and (save-excursion + (beginning-of-line) + (not (looking-at "^.*//.*[[:graph:]]"))) + (save-excursion + (re-search-backward "//" (point-at-bol) t)))) + + +(defun js-fill-sline-comments (parse-status justify) + "Fill current paragraph as a sequence of single-line comments. +PARSE-STATUS is the result of `parse-partial-regexp' from +beginning of buffer to point. JUSTIFY has the same meaning as in +`fill-paragraph'." + (when (not (js-at-empty-sline-comment-p)) + (let* ((start (js-sline-comment-par-start)) + (start-line (1+ (count-lines (point-min) start))) + (end (js-sline-comment-par-end)) + (offset (js-sline-comment-offset start-line)) + (text-offset (js-sline-comment-text-offset start-line))) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*//[ \t]*" nil t) + (replace-match "") + (forward-line 1)) + (let ((fill-paragraph-function nil) + (fill-column (- fill-column text-offset))) + (fill-paragraph justify)) + + ;; In Emacs 21.4 as opposed to CVS Emacs 22, + ;; `fill-paragraph' seems toadd a newline at the end of the + ;; paragraph. Remove it! + (goto-char (point-max)) + (when (looking-at "^$") (backward-delete-char 1)) + + (goto-char (point-min)) + (while (not (eobp)) + (indent-to offset) + (insert "//") + (indent-to text-offset) + (forward-line 1))))))) + + +(defun js-trailing-comment-p (parse-status) + "Return non-nil if inside a trailing comment. PARSE-STATUS is +the result of `parse-partial-regexp' from beginning of buffer to +point." + (save-excursion + (when (nth 4 parse-status) + (goto-char (nth 8 parse-status)) + (skip-chars-backward " \t") + (not (bolp))))) + + +(defun js-block-comment-p (parse-status) + "Return non-nil if inside a block comment. PARSE-STATUS is the +result of `parse-partial-regexp' from beginning of buffer to +point." + (save-excursion + (save-match-data + (when (nth 4 parse-status) + (goto-char (nth 8 parse-status)) + (looking-at "/\\*"))))) + + +(defun javascript-fill-paragraph (&optional justify) + "If inside a comment, fill the current comment paragraph. +Trailing comments are ignored." + (interactive) + (let ((parse-status (parse-partial-sexp (point-min) (point)))) + (when (and (nth 4 parse-status) + (not (js-trailing-comment-p parse-status))) + (if (js-block-comment-p parse-status) + (js-fill-block-comment-paragraph parse-status justify) + (js-fill-sline-comments parse-status justify)))) + t) + + +;; --- Imenu --- + +(defconst js-imenu-generic-expression + (list + (list + nil + "function\\s-+\\(\\w+\\)\\s-*(" + 1)) + "Regular expression matching top level procedures. Used by imenu.") + + +;; --- Main Function --- + +;;;###autoload +(defun javascript-mode () + "Major mode for editing JavaScript source text. + +Key bindings: + +\\{javascript-mode-map}" + (interactive) + (kill-all-local-variables) + + (use-local-map javascript-mode-map) + (set-syntax-table javascript-mode-syntax-table) + (set (make-local-variable 'indent-line-function) 'javascript-indent-line) + (set (make-local-variable 'font-lock-defaults) (list js-font-lock-keywords)) + + (set (make-local-variable 'parse-sexp-ignore-comments) t) + + ;; Comments + (setq comment-start "// ") + (setq comment-end "") + (set (make-local-variable 'fill-paragraph-function) + 'javascript-fill-paragraph) + + ;; Imenu + (setq imenu-case-fold-search nil) + (set (make-local-variable 'imenu-generic-expression) + js-imenu-generic-expression) + + (setq major-mode 'javascript-mode) + (setq mode-name "JavaScript") + (run-hooks 'javascript-mode-hook)) + + +(provide 'javascript-mode) +;;; javascript.el ends here Added: trunk/scripts/emacs/pmp-emacs.el =================================================================== --- trunk/scripts/emacs/pmp-emacs.el (rev 0) +++ trunk/scripts/emacs/pmp-emacs.el 2006-08-10 00:19:45 UTC (rev 181) @@ -0,0 +1,40 @@ +;; Check if we're editing a file from a pmplib svn checkout +(defun pmplib-checksvn (file) + (and file + (file-regular-p file) + (let ((entries (concat (file-name-directory file) + ".svn/entries"))) + (when (file-regular-p entries) + (with-temp-buffer + ;; We can probably find the repo url in the first 300 chars + (insert-file-contents entries t) + (search-forward "<entry" nil nil) + (search-forward "<entry" nil nil) + (search-backward "sourceforge.net/svnroot/pmplib" nil nil)))))) + +;; Tabs are evil. +(defface pmp-tab-face + '((t (:background "#fafaff"))) + "Used for tabs.") + +(defun maybe-pmplib-style () + (when (pmplib-checksvn buffer-file-name) + ;; Huh, what style *are* we using? :) + (c-set-style "linux") + (font-lock-add-keywords nil + '(("\t" . 'pmp-tab-face))) + (setq c-basic-offset 4 + tab-width 4 + indent-tabs-mode t))) + +(add-hook 'c-mode-hook 'maybe-pmplib-style) +;;(add-hook 'c-mode-hook +;; (lambda () +;; (font-lock-add-keywords +;; nil '(("\t" . 'pmp-tab-face))))) + +;; JSPL editing +(autoload 'javascript-mode "javascript" nil t) +(add-to-list 'auto-mode-alist '("\\.js\\(pl?\\)\\'" . javascript-mode)) + +(provide 'pmp-emacs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-06 18:01:38
|
Revision: 180 Author: sucknblow Date: 2006-08-06 11:01:32 -0700 (Sun, 06 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=180&view=rev Log Message: ----------- Oops. fd_is_tty is always used, and therefore always needs to be initialised, regardless of whether we can detect terminal size. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-05 22:50:29 UTC (rev 179) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-06 18:01:32 UTC (rev 180) @@ -96,11 +96,11 @@ void display_init() { -#if CAN_GET_WIN_SIZE int i; for(i = 0; i <= 2; ++i) fd_is_tty[i] = isatty(i); +#if CAN_GET_WIN_SIZE signal(SIGWINCH,window_size_changed); window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-05 22:50:39
|
Revision: 179 Author: sucknblow Date: 2006-08-05 15:50:29 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=179&view=rev Log Message: ----------- * Detect width of the terminal. * Avoid printing many blank lines when displaying progress on terminals of width < 80. * Truncate long track names to the width of the terminal. * Clear the line properly for files with very long names. * Introduces easypmp_progress_num_str, for progress messages with both a number and a string. * Dump the whole line to the output if the output is not associated with a tty. * Use stdout rather than stderr for a few more things. Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/cui/util.h Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/configure.in 2006-08-05 22:50:29 UTC (rev 179) @@ -65,7 +65,8 @@ dnl Checks for header files. dnl ------------------------------------------------------------------ AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h unistd.h stdint.h getopt.h) +AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h unistd.h \ + stdint.h getopt.h signal.h sys/ioctl.h) dnl ------------------------------------------------------------------ @@ -186,6 +187,26 @@ dnl Check for libsmjs (SpiderMonkey JavaScript engine) AC_PATH_SPIDERMONKEY +dnl ------------------------------------------------------------------ +dnl Check whether we can detect the terminal window size +dnl (Already checked for signal.h, sys/ioctl.h) +dnl ------------------------------------------------------------------ +if test "$ac_cv_header_signal_h" = "yes" -a \ + "$ac_cv_header_sys_ioctl_h" = "yes" ; then +AC_MSG_CHECKING([whether terminal window size can be detected]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include <signal.h> +#include <sys/ioctl.h>]],[[ +struct winsize wsize; +signal(SIGWINCH, 0); +ioctl(0, TIOCGWINSZ, &wsize);]]) + ], + [AC_DEFINE([CAN_GET_WIN_SIZE],1,[Define to 1 if you can set a signal + handler for SIGWINCH, and use the TIOCGWINSZ ioctl.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no, assuming width of 80.])]) +fi dnl ------------------------------------------------------------------ dnl Export variables Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-05 22:50:29 UTC (rev 179) @@ -59,22 +59,25 @@ void device_show_information(pmp_t* pmp, FILE *fpe); void device_enumerate(pmphelp_t* pmphelp); +int +easypmp_progress_num_str( + FILE *fp, + size_t n, + const ucs2char_t* msg); + static int easypmp_enumerate_progress( void *instance, const ucs2char_t* path, const ucs2char_t* file, - size_t n - ) + size_t n) { - FILE *fpe = stderr; - - clear_line(fpe); - fprintf(fpe, " %d: ", n); - fprints(fpe, "%s\r", file); + FILE *fpe = stdout; + easypmp_progress_num_str(fpe, n, file); return 0; } + static int easypmp_progress( void *instance, @@ -91,39 +94,37 @@ case EASYPMPDBP_START: break; case EASYPMPDBP_READ|EASYPMPSP_START: - fprintf(fpe, "Reading database\n"); + fprintf(fpo, "Reading database\n"); break; case EASYPMPDBP_READ|EASYPMPSP_PROGRESS: break; case EASYPMPDBP_READ|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_GMI|EASYPMPSP_START: - fprintf(fpe, "Obtaining media information from %d files\n", param_int); + fprintf(fpo, "Obtaining media information from %d files\n", param_int); break; case EASYPMPDBP_GMI|EASYPMPSP_PROGRESS: - clear_line(fpe); - fprintf(fpe, " %d: ", param_int+1); - fprints(fpe, "%s\r", filepath_skippath(param_str)); + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; case EASYPMPDBP_GMI|EASYPMPSP_END: - clear_line(fpe); - fprintf(fpe, " %d files were imported\n", param_int); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d files were imported\n", param_int); + fprintf(fpo, "\n"); break; case EASYPMPDBP_UPDATE|EASYPMPSP_START: - fprintf(fpe, "Updating database\n"); + fprintf(fpo, "Updating database\n"); break; case EASYPMPDBP_UPDATE|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_WRITE|EASYPMPSP_START: - fprintf(fpe, "Writing database\n"); + fprintf(fpo, "Writing database\n"); break; case EASYPMPDBP_WRITE|EASYPMPSP_PROGRESS: break; case EASYPMPDBP_WRITE|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_END: break; @@ -131,12 +132,10 @@ case EASYPMPPLP_START: break; case EASYPMPPLP_CONVERT|EASYPMPSP_START: - fprintf(fpe, "Converting playlists\n"); + fprintf(fpo, "Converting playlists\n"); break; case EASYPMPPLP_CONVERT|EASYPMPSP_PROGRESS: - clear_line(fpe); - fprintf(fpe, " %d: ", param_int+1); - fprints(fpe, "%s\r", filepath_skippath(param_str)); + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; case EASYPMPPLP_CONVERT|EASYPMPSP_WARN_PLAYLIST: fprintf(fpe, "\n"); @@ -150,6 +149,7 @@ fprints(fpe, " %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_ERROR: + fprintf(fpe, "\n"); fprints(fpe, " JSPL(ERROR): %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_ERROR_POS: @@ -162,7 +162,7 @@ fprints(fpo, " JSPL: %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPPLP_END: break; @@ -215,8 +215,8 @@ option_init(&opt); // Show copyright information. - fprintf(fpe, APPLICATION_S " " VERSION_S " " COPYRIGHT_S "\n"); - fprintf(fpe, "\n"); + fprintf(fpo, APPLICATION_S " " VERSION_S " " COPYRIGHT_S "\n"); + fprintf(fpo, "\n"); // Parse the command-line arguments. used_args = option_parse(&opt, argc, argv, fpe); @@ -320,25 +320,26 @@ } // Show player information. - device_show_information(pmp, fpe); - fprintf(fpe, "\n"); + device_show_information(pmp, fpo); + fprintf(fpo, "\n"); memset(&musics, 0, sizeof(musics)); + display_init(); if ((opt.verb & MODE_DATABASE) || ((opt.verb & MODE_PLAYLIST) && (opt.verb & MODE_PLAYLIST_FIND))) { - fprintf(fpe, "Enumerating music files\n"); + fprintf(fpo, "Enumerating music files\n"); easypmp_enumerate_music(&musics, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpe); - fprintf(fpe, " %d music files were found\n", musics.num_elements); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d music files were found\n", musics.num_elements); + fprintf(fpo, "\n"); } memset(&playlists, 0, sizeof(playlists)); if (opt.verb & MODE_PLAYLIST) { fprintf(fpe, "Enumerating playlist files\n"); easypmp_enumerate_playlist(&playlists, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpe); - fprintf(fpe, " %d music files were found\n", playlists.num_elements); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d music files were found\n", playlists.num_elements); + fprintf(fpo, "\n"); } // Execute jobs. Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-05 22:50:29 UTC (rev 179) @@ -30,17 +30,189 @@ #endif/*HAVE_STRING_H*/ #include <os.h> +#include <systems.h> #include <stdio.h> #include <stdlib.h> #include <ucs2char.h> +#if CAN_GET_WIN_SIZE +#include <sys/ioctl.h> +#include <signal.h> +#endif/*CAN_GET_WIN_SIZE*/ + #include "util.h" + +#if CAN_GET_WIN_SIZE +/* + The number of characters that can be printed on a single line, + without causing a line wrap. Since the right-most column is + required for the cursor, this is one less than the actual terminal + width. + + Defaults to 79 on systems where we can't tell the width of the + terminal. +*/ +static volatile unsigned short int window_width; +#else +static const unsigned short int window_width = 79; +#endif + +/* + The minimum width of the terminal we're willing to entertain. If the + terminal gets narrower than this width, we treat it as this width. + Note that it must be at least 2 to allow for one character and the + cursor. +*/ +static const int min_term_width = 6; + + +/* + Flags to indicate whether stdin, stdout, and stderr are attached to a + terminal. These are used to determine whether we should check the + width of some progress lines before printing them. Initialised in + display_init. + */ +#define POSSIBLE_TTYS 2 +static int fd_is_tty[POSSIBLE_TTYS+1]; + +#if CAN_GET_WIN_SIZE +/* + Hander for the "terminal window changed size" signal. +*/ +void window_size_changed(int unused) +{ + static struct winsize wsize; + if (ioctl(1, TIOCGWINSZ, &wsize) != -1) { + if (wsize.ws_col > min_term_width) { + window_width = wsize.ws_col - 1; + } else { + window_width = min_term_width; + } + } +} + +#endif/*CAN_GET_WIN_SIZE*/ + +void display_init() +{ +#if CAN_GET_WIN_SIZE + int i; + for(i = 0; i <= 2; ++i) + fd_is_tty[i] = isatty(i); + + signal(SIGWINCH,window_size_changed); + window_size_changed(0); +#endif/*CAN_GET_WIN_SIZE*/ +} + +/* + Delete all text on the current line by overwriting it with spaces, + and write a \r to return the cursor to the start of the line. +*/ void clear_line(FILE *fp) { - fprintf(fp, "%-79.79s\r", ""); + /* fmt needs 4 chars (%, -, s, \r) + + room for window_width as string (max. 65535) + + null terminator */ + char fmt[10]; + sprintf(fmt, "%%-%us\r", window_width); + fprintf(fp, fmt, ""); } + +/* + Display as much of a UCS-2 encoded string as will fit on a single + line in the terminal, and returning the cursor to the start of the + line. If the terminal is less that the given minimum width, display + that minimum number of characters anyway, even if it means the text + will wrap onto the next line. + + If fp isn't associated with a terminal, just print the whole line. + + fp - FILE* to print on + line - the UCS-2 encoded string to display + min-width - minimum number of characters to print + */ +void display_line(FILE *fp, const ucs2char_t* const line, unsigned int min_width) +{ + int writing_to_tty; + /* Check if writing to a terminal. If so, clear the current line. */ + int fd = fileno(fp); + if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { + clear_line(fp); + writing_to_tty = TRUE; + } else { + writing_to_tty = FALSE; + } + + unsigned int length = ucs2len(line); + const ucs2char_t* line_to_print; + + if(!writing_to_tty) { + /* Write the whole line to the file, add \n. */ + fprints(fp, "%s\r\n", line); + } else if (length <= window_width) { + /* There's enough room to show the whole line. */ + fprints(fp, "%s\r", line); + } + else { + /* Length of the longest string we might display: */ + const int max_trunc_length = MAX(window_width,min_width); + + /* Length of string we actually will display: */ + const size_t trunc_length = MIN(max_trunc_length, length); + + ucs2char_t truncated_line[trunc_length+1]; + truncated_line[trunc_length]=0; + ucs2ncpy(truncated_line, line, trunc_length); + fprints(fp, "%s\r", truncated_line); + } +} + +/* + Generic display method for progress messages consisting of a number + and a string. + + n - number to be shown in the numeric part + msg - message + */ +int +easypmp_progress_num_str( + FILE *fp, + size_t n, + const ucs2char_t* msg + ) +{ + /* + A terminal must be of a certain width in order to usefully + show progress when enumerating/reading media files. + Specifically, it needs to be wide enough to display the + number of files read. + + display_line is used to trucate the line in this way. + */ + + // Numeric part, plus associated punctuation + const int prefix_length = 16; + char fmt[prefix_length + 1]; + + ucs2char_t line[ucs2len(msg) + prefix_length + 1]; + ucs2char_t *fmt_ucs2; + + // Build the numeric part... + sprintf(fmt, " %u: ", n); + fmt_ucs2 = mbsdupucs2(fmt); + if (fmt_ucs2) { + ucs2cpy(line, fmt_ucs2); + // ... and append the message. + ucs2cat(line, msg); + display_line(fp, line, strlen(fmt)); + ucs2free(fmt_ucs2); + } + return 0; +} + void fprints(FILE *fp, const char *format, const ucs2char_t* value) { fprints_fixed(fp, format, value, ucs2len(value)); @@ -58,3 +230,11 @@ ucs2free(mbs); } } + +/* + * Local Variables: + * indent-tabs-mode: t + * tab-width: 8 + * c-basic-offset: 8 + * End: + */ Modified: trunk/pmplib/frontend/easypmp/cui/util.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-05 22:50:29 UTC (rev 179) @@ -25,6 +25,8 @@ #ifndef __UTIL_H__ #define __UTIL_H__ +void display_init(); + void clear_line(FILE *fp); void fprints(FILE *fp, const char *format, const ucs2char_t* value); void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-08-02 21:33:14
|
Revision: 178 Author: sucknblow Date: 2006-08-02 14:33:07 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=178&view=rev Log Message: ----------- Freeing alloc'd data before exit quietens the debugger. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-02 17:59:32 UTC (rev 177) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-02 21:33:07 UTC (rev 178) @@ -315,7 +315,8 @@ ret = pmphelp_create(pmphelp, &pmp, opt.path_to_root, opt.model); if (!pmp) { fprintf(fpe, "Failed to find a player (%d)\n", ret); - return 1; + ret = 1; + goto exit_main; } // Show player information. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-08-02 17:59:44
|
Revision: 177 Author: nyaochi Date: 2006-08-02 10:59:32 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=177&view=rev Log Message: ----------- Initial attempt to support Philips HDD6320 player. Modified Paths: -------------- trunk/pmplib/lib/pmp_portalplayer1/Makefile.am trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj Added Paths: ----------- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c Modified: trunk/pmplib/lib/pmp_portalplayer1/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2006-08-01 07:13:03 UTC (rev 176) +++ trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2006-08-02 17:59:32 UTC (rev 177) @@ -25,6 +25,7 @@ model_medion_mdjuke440.c \ model_sirius_s50.c \ model_samsung.c \ + model_philips_hdd6320.c \ pmp_portalplayer1.c portalplayer1_la_LDFLAGS = \ Modified: trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2006-08-01 07:13:03 UTC (rev 176) +++ trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2006-08-02 17:59:32 UTC (rev 177) @@ -73,7 +73,7 @@ fprintf(fp, "%d, ", fd->has_index); fprintf(fp, "%d, ", fd->unknown6); fprintf(fp, "%d, ", fd->unknown7); - fprints(fp, "L\"%s\"", fd->index_pathname); + fprints(fp, "\"%s\"", fd->index_pathname); fprintf(fp, "}"); } Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h 2006-08-01 07:13:03 UTC (rev 176) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h 2006-08-02 17:59:32 UTC (rev 177) @@ -70,9 +70,11 @@ int hdr_init_samsung_yh920(hdr_t* hdr); int hdr_init_samsung_yh925(hdr_t* hdr); int hdr_init_sirius_s50(hdr_t* hdr); +int hdr_init_philips_hdd6320(hdr_t* hdr); int iriver_h10_parse_model(const ucs2char_t* firmware, pp1model_t* model); int medion_mdjuke220_parse_model(const ucs2char_t* firmware, pp1model_t* model); int samsung_parse_model(const ucs2char_t* firmware, pp1model_t* model); +int philips_hdd6320_parse_model(const ucs2char_t* firmware, pp1model_t* model); #endif/*__HDR_TEMPLATE_H__*/ Added: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c (rev 0) +++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2006-08-02 17:59:32 UTC (rev 177) @@ -0,0 +1,254 @@ +/* + * Philips HDD6320 specific routines and header templates. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <filepath.h> + +#include "serialize.h" +#include "util.h" +#include "pp1db.h" +#include "hdr_template.h" + +enum { + PP1DB_DATFIELD_UNKNOWN2 = 0,// @0: (INT) + PP1DB_DATFIELD_PATHNAME, // @1: (STR) + PP1DB_DATFIELD_FILENAME, // @2: (STR) + PP1DB_DATFIELD_FORMAT, // @3: (INT) + PP1DB_DATFIELD_ARTIST, // @4: (STR) + PP1DB_DATFIELD_ALBUM, // @5: (STR) + PP1DB_DATFIELD_GENRE, // @6: (STR) + PP1DB_DATFIELD_TITLE, // @7: (STR) + PP1DB_DATFIELD_TRACKNUMBER, // @8: (INT) + PP1DB_DATFIELD_COMPOSER, // @9: (STR) + PP1DB_DATFIELD_UNKNOWN3, // @10: (INT) + PP1DB_DATFIELD_UNKNOWN4, // @11: (STR) + PP1DB_DATFIELD_UNKNOWN5, // @12: (STR) + PP1DB_DATFIELD_UNKNOWN6, // @13: (STR) + PP1DB_DATFIELD_UNKNOWN7, // @14: (INT) + PP1DB_DATFIELD_UNKNOWN8, // @15: (STR) + PP1DB_DATFIELD_UNKNOWN9, // @16: (STR) +}; + +static void philips_hdd6320_dat_repr(const dat_t* record, FILE *fp) +{ + fprintf(fp, " inactive: %d\n", record->status); + fprintf(fp, " unknown1: %d\n", record->unknown1); + fprintf(fp, " unknown2: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN2].value.dword); + fprints(fp, " file_path: %s\n", record->fields[PP1DB_DATFIELD_PATHNAME].value.str); + fprints(fp, " file_name: %s\n", record->fields[PP1DB_DATFIELD_FILENAME].value.str); + fprintf(fp, " media_type: %d\n", record->fields[PP1DB_DATFIELD_FORMAT].value.dword); + fprints(fp, " artist: %s\n", record->fields[PP1DB_DATFIELD_ARTIST].value.str); + fprints(fp, " album: %s\n", record->fields[PP1DB_DATFIELD_ALBUM].value.str); + fprints(fp, " genre: %s\n", record->fields[PP1DB_DATFIELD_GENRE].value.str); + fprints(fp, " title: %s\n", record->fields[PP1DB_DATFIELD_TITLE].value.str); + fprintf(fp, " number: %d\n", record->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword); + fprints(fp, " composer: %s\n", record->fields[PP1DB_DATFIELD_COMPOSER].value.str); + fprintf(fp, " unknown3: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN3].value.dword); + fprintf(fp, " unknown4: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword); + fprintf(fp, " unknown5: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN5].value.dword); + fprintf(fp, " unknown6: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN6].value.dword); + fprintf(fp, " unknown7: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN7].value.dword); + fprintf(fp, " unknown8: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN8].value.dword); + fprintf(fp, " unknown9: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN9].value.dword); +} + +static int philips_hdd6320_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +{ + static const ucs2char_t ucs2cs_unknown[] = {0}; + static const ucs2char_t ucs2cs_empty[] = {0}; + + // Set fields. + dst->status = 0; + dst->unknown1 = 0; + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); + filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); + filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number; + dst->fields[PP1DB_DATFIELD_COMPOSER].value.str = ucs2dup(src->composer ? src->composer : ucs2cs_unknown); + + dst->fields[PP1DB_DATFIELD_UNKNOWN3].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN5].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN6].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN7].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN8].value.dword = 0; + dst->fields[PP1DB_DATFIELD_UNKNOWN9].value.dword = 0; + return 0; +} + +static int philips_hdd6320_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +{ + static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; + static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; + static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + size_t length = 0; + + memset(dst, 0, sizeof(*dst)); + + length = ucs2len(path_to_root); + length += ucs2len(src->fields[PP1DB_DATFIELD_PATHNAME].value.str); + length += ucs2len(src->fields[PP1DB_DATFIELD_FILENAME].value.str); + length += 3; + + dst->filename = (ucs2char_t*)ucs2malloc(sizeof(ucs2char_t) * length); + if (dst->filename) { + filepath_combinepath(dst->filename, length, path_to_root, src->fields[PP1DB_DATFIELD_PATHNAME].value.str); + filepath_addslash(dst->filename); + ucs2cat(dst->filename, src->fields[PP1DB_DATFIELD_FILENAME].value.str); + } + + dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); + dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); + dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); + dst->title = ucs2dup(src->fields[PP1DB_DATFIELD_TITLE].value.str); + dst->track_number = src->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword; + dst->composer = ucs2dup(src->fields[PP1DB_DATFIELD_COMPOSER].value.str); + + // Set codec information according to the file extensions. + if (filepath_hasext(dst->filename, ucs2cs_mp3)) { + dst->codec = PMPCODEC_MPEGLAYER3; + } else if (filepath_hasext(dst->filename, ucs2cs_wma)) { + dst->codec = PMPCODEC_WMA; + } else if (filepath_hasext(dst->filename, ucs2cs_wav)) { + dst->codec = PMPCODEC_WAV; + } + + return 0; +} + +int philips_hdd6320_parse_model(const ucs2char_t* firmware, pp1model_t* model) +{ + /* + Firmware dump (FWImage.DMP) + ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF + ------------------------------------------------------------------------------ + 00000200 58 05 00 EA 45 05 00 EA 0E F0 B0 E1 49 05 00 EA X...E.......I... + 00000210 4E 05 00 EA FE FF FF EA 36 05 00 EA 2C 05 00 EA N.......6...,... + 00000220 70 6F 72 74 61 6C 70 6C 61 79 65 72 00 30 2E 30 portalplayer.0.0 + 00000230 C0 00 65 D0 94 00 5E F6 00 00 00 00 00 00 00 00 ..e...^......... + 00000240 50 50 35 30 32 32 41 46 2D 30 35 2E 34 30 2D 50 PP5022AF-05.40-P + 00000250 50 30 37 2D 30 35 2E 34 30 2D 4D 47 30 32 2D 30 P07-05.40-MG02-0 + 00000260 30 2E 30 31 2D 44 54 00 41 52 49 5A 4F 4E 41 00 0.01-DT.ARIZONA. + 00000270 32 2E 31 00 44 69 67 69 74 61 6C 20 4D 65 64 69 2.1.Digital Medi + 00000280 61 20 50 6C 61 74 66 6F 72 6D 00 00 43 6F 70 79 a Platform..Copy + 00000290 72 69 67 68 74 28 63 29 20 31 39 39 39 20 2D 20 right(c) 1999 - + 000002A0 32 30 30 33 20 50 6F 72 74 61 6C 50 6C 61 79 65 2003 PortalPlaye + 000002B0 72 2C 20 49 6E 63 2E 20 20 41 6C 6C 20 72 69 67 r, Inc. All rig + 000002C0 68 74 73 20 72 65 73 65 72 76 65 64 2E 00 00 00 hts reserved.... + 000002D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 000002E0 00 01 00 00 EC 00 00 00 94 D0 65 00 00 10 A0 E1 ..........e..... + 000002F0 40 25 A0 E3 00 20 81 E5 01 00 A0 E3 0E F0 A0 E1 @%... .......... + */ + + FILE *fp = ucs2fopen(firmware, "rb"); + if (fp) { + char line[65], *p = NULL, *q = NULL; + memset(line, 0, sizeof(line)); + + // Seek to the firmware information. + if (fseek(fp, 0x0240, SEEK_SET) != 0) { + fclose(fp); + return 0; + } + + // Read the firmware information. + if (fread(line, sizeof(char), 64, fp) != 64) { + fclose(fp); + return 0; + } + + // Close the firmware. + fclose(fp); + + // Obtain the model name. + strcpy(model->name, "Philips HDD6320"); + strcpy(model->version, "05.40"); + strcpy(model->mode, "UM"); + return 1; + } else { + return 0; + } +} + + + + +static fd_template_t hdrtmpl_fd_philips_hdd6320[] = { + {0x0000F001, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP...@DE...X"}, + {0x0000F002, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_FPTH.IDX"}, + {0x0000F003, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_FNAM.IDX"}, + {0x0000F00A, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_FRMT.IDX"}, + {0x10B9003C, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TPE1.IDX"}, + {0x2054001C, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TALB.IDX"}, + {0x320A001F, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TCON.IDX"}, + {0x0000002E, 1, 256, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TIT2.IDX"}, + {0x00750043, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TRCK.IDX"}, + {0x0000001E, 1, 64, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_TCOM.IDX"}, + {0x54430011, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_PCNT.IDX"}, + {0x061A005D, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_.IDX"}, + {0x0000008D, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_BUYF.IDX"}, + {0x0000008E, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP5000_MODF.IDX"}, + {0x8000008F, 2, 4, 0, 0, 0, 0, 0, ""}, + {0x0000E000, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP...@DU...X"}, + {0x0004E001, 2, 4, 0, 0, 1, 0, 0, "SYSTEM\\DATA\\PP...@DU...X"}, + {0x00000000, 0, 0, 0, 0, 0, 0, 0, ""}, + {0x00000000, 0, 0, 0, 0, 0, 0, 0, ""}, + {0x00000000, 0, 0, 0, 0, 0, 0, 0, ""}, + {0x00000000, 0, 0, 0, 0, 0, 0, 0, ""}, + {0x00000000, 0, 0, 0, 0, 0, 0, 0, ""}, +}; + +static uint32_t hdrtmpl_max_dat_field_size_philips_hdd6320[] = + {8, 12, 524, 1036, 1040, 1552, 2064, 2576, 3088, 3092, 3220, 3224, 3228, 3232, 3236, 3240, 3244, 0, 0, 0, 0, 0}; + + +/********** Philips HDD6320 firmware x.xx **********/ +static hdr_template_t hdrtmpl_philips_hdd6320 = { + 0, 0, "System\\DATA\\PP5000.DAT", 1, "System\\DATA\\PP5000.HDR", 0x00000CB0, 0, 0, 17, + hdrtmpl_fd_philips_hdd6320, + hdrtmpl_max_dat_field_size_philips_hdd6320, + 0, 1, + {589120, 22, 12000, 0, 1, philips_hdd6320_dat_repr, philips_hdd6320_dat_set, philips_hdd6320_dat_get}, +}; + +int hdr_init_philips_hdd6320(hdr_t* hdr) +{ + return apply_template(hdr, &hdrtmpl_philips_hdd6320); +} Property changes on: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2006-08-01 07:13:03 UTC (rev 176) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2006-08-02 17:59:32 UTC (rev 177) @@ -167,6 +167,14 @@ ".plp", hdr_init_samsung_yh925, samsung_parse_model }, + { + "philips_hdd6320", "Philips HDD6320", + 20, "UM", + "5.40", "5.40", + "SYSTEM\\FWImage.ebn", "System\\DATA\\PP5000.HDR", "Music\\", "Playlists\\", + ".pla", + hdr_init_philips_hdd6320, philips_hdd6320_parse_model + }, #if 0 { "sirius_s50", "Sirius S50", Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj 2006-08-01 07:13:03 UTC (rev 176) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj 2006-08-02 17:59:32 UTC (rev 177) @@ -144,6 +144,9 @@ RelativePath=".\model_medion_mdjuke440.c"> </File> <File + RelativePath=".\model_philips_hdd6320.c"> + </File> + <File RelativePath=".\model_samsung.c"> </File> <File This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-08-01 07:13:13
|
Revision: 176 Author: nyaochi Date: 2006-08-01 00:13:03 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=176&view=rev Log Message: ----------- Web site for 0.12 release. I failed to install SMF to /forum directory due to the tight security on sf.net (they don't allow writable accesses to any files on the web server). Modified Paths: -------------- trunk/webpage/news.xml trunk/webpage/pmplib.xsl Modified: trunk/webpage/news.xml =================================================================== --- trunk/webpage/news.xml 2006-07-30 21:11:57 UTC (rev 175) +++ trunk/webpage/news.xml 2006-08-01 07:13:03 UTC (rev 176) @@ -46,7 +46,6 @@ </p> <ul> <li>Migrated from MODx CMS to our original CMS based on XSLT.</li> -<li>Launched <a href="http://pmplib.sourceforge.net/forum/">PMPlib discussion forum</a>.</li> </ul> </ni> Modified: trunk/webpage/pmplib.xsl =================================================================== --- trunk/webpage/pmplib.xsl 2006-07-30 21:11:57 UTC (rev 175) +++ trunk/webpage/pmplib.xsl 2006-08-01 07:13:03 UTC (rev 176) @@ -299,7 +299,7 @@ <li><a href="document_jspl.html">JavaScript Playlist (JSPL)</a></li> </ul> </li> - <li><a href="./forum/">Forum</a></li> + <li><a href="http://sourceforge.net/forum/?group_id=157298">Forum</a></li> <!--<li><a href="faq.html">FAQ</a></li>--> <li><a href="about.html">About</a></li> <li><a href="http://sourceforge.net/projects/pmplib/">Project Home</a></li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |