OSDN Git Service

separete traydata generation fron datlayout_t.
authorornse01 <ornse01@users.sourceforge.jp>
Fri, 31 Dec 2010 11:27:13 +0000 (11:27 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Fri, 31 Dec 2010 11:27:13 +0000 (11:27 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@169 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/Makefile
src/layout.c
src/layout.h
src/main.c
src/render.c
src/tadlib.c
src/tadlib.h
src/traydata.c [new file with mode: 0644]
src/traydata.h [new file with mode: 0644]

index e662254..3fc0f80 100644 (file)
@@ -38,7 +38,7 @@ VPATH = $(S)
 HEADER := $(S) $(HEADER)
 
 # ¥½¡¼¥¹¥Õ¥¡¥¤¥ë
-SRC =  main.c cache.c parser.c layout.c window.c retriever.c tadlib.c confirm.c poptray.c postres.c http.c submit.c sjisstring.c parselib.c submitutil.c bchan_vobj.c tadurl.c bchan_panels.c bchan_menus.c residhash.c resindexhash.c tadimf.c layoutarray.c array.c render.c layoutstyle.c
+SRC =  main.c cache.c parser.c layout.c window.c retriever.c tadlib.c confirm.c poptray.c postres.c http.c submit.c sjisstring.c parselib.c submitutil.c bchan_vobj.c tadurl.c bchan_panels.c bchan_menus.c residhash.c resindexhash.c tadimf.c layoutarray.c array.c render.c layoutstyle.c traydata.c
 
 # ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
 DBSRC =
index c749b93..e3e4307 100644 (file)
@@ -50,131 +50,6 @@ struct datlayout_t_ {
        datlayoutarray_t *boxarray;
 };
 
-LOCAL TC dec[] = {TK_0,TK_1,TK_2,TK_3,TK_4,TK_5,TK_6,TK_7,TK_8,TK_9};
-
-LOCAL W datlayout_res_UW_to_str(UW num, TC *dest)
-{
-       W i = 0, digit, draw = 0;
-       TC dummy_str[10];
-
-       if (dest == NULL) {
-               dest = dummy_str;
-       }
-
-       digit = num / 1000 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               dest[i++] = dec[digit];
-               draw = 1;
-       }
-       digit = num / 100 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               dest[i++] = dec[digit];
-               draw = 1;
-       }
-       digit = num / 10 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               dest[i++] = dec[digit];
-               draw = 1;
-       }
-       digit = num % 10;
-       if ((digit != 0)||(draw != 0)) {
-               dest[i++] = dec[digit];
-               draw = 1;
-       }
-
-       return i;
-}
-
-LOCAL W datlayout_res_totraytextdata_write_zenkaku(TC *str)
-{
-       TADSEG *seg = (TADSEG*)str;
-
-       if (str == NULL) {
-               return 10;
-       }
-
-       seg->id = 0xFF00|TS_TFONT;
-       seg->len = 6;
-       *(UH*)(str + 2) = 3 << 8;
-       *(RATIO*)(str + 3) = 0x0101;
-       *(RATIO*)(str + 4) = 0x0101;
-
-       return 10;
-}
-
-LOCAL W datlayout_res_totraytextdata(datlayout_res_t *res, B *data, W data_len)
-{
-       W i = 0, num, digit, draw = 0;
-       TC *str = (TC*)data;
-
-       if (data != NULL) {
-               num = res->index + 1;
-               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
-               digit = num / 1000 % 10;
-               if ((digit != 0)||(draw != 0)) {
-                       str[i++] = dec[digit];
-                       draw = 1;
-               }
-               digit = num / 100 % 10;
-               if ((digit != 0)||(draw != 0)) {
-                       str[i++] = dec[digit];
-                       draw = 1;
-               }
-               digit = num / 10 % 10;
-               if ((digit != 0)||(draw != 0)) {
-                       str[i++] = dec[digit];
-                       draw = 1;
-               }
-               digit = num % 10;
-               if ((digit != 0)||(draw != 0)) {
-                       str[i++] = dec[digit];
-                       draw = 1;
-               }
-               str[i++] = TK_KSP;
-               i += tadlib_remove_TA_APPL(res->parser_res->name, res->parser_res->name_len, str + i, data_len - i / 2) / 2;
-               str[i++] = TK_KSP;
-               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
-               str[i++] = TK_LABR;
-               i += tadlib_remove_TA_APPL(res->parser_res->mail, res->parser_res->mail_len, str + i, data_len - i / 2) / 2;
-               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
-               str[i++] = TK_RABR;
-               str[i++] = TK_KSP;
-               i += tadlib_remove_TA_APPL(res->parser_res->date, res->parser_res->date_len, str + i, data_len - i / 2) / 2;
-               str[i++] = TK_NL;
-               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
-               i += tadlib_remove_TA_APPL(res->parser_res->body, res->parser_res->body_len, str + i, data_len - i / 2) / 2;
-               str[i++] = TK_NL;
-       } else {
-               num = res->index + 1;
-               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
-               if ((0 <= num)&&(num < 10)) {
-                       i += 1;
-               } else if ((10 <= num)&&(num < 100)) {
-                       i += 2;
-               } else if ((100 <= num)&&(num < 1000)) {
-                       i += 3;
-               } else if (1000 <= num) {
-                       i += 4;
-               }
-               i++; /* TK_KSP */
-               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->name, res->parser_res->name_len) / 2;
-               i++; /* TK_KSP */
-               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
-               i++; /* TO_LABR */
-               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->mail, res->parser_res->mail_len) / 2;
-               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
-               i++; /* TO_RABR */
-               i++; /* TK_KSP */
-               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->date, res->parser_res->date_len) / 2;
-               i++; /* TK_NL */
-               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
-               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->body, res->parser_res->body_len) / 2;
-               i++; /* TK_NL */
-       }
-
-       return i * sizeof(TC);
-}
-
 LOCAL W datlayout_res_calcresheaderdrawsize(datlayout_res_t *layout_res, GID gid, SIZE *sz)
 {
        SIZE sz_number = {0,0}, sz_name = {0,0}, sz_mail = {0,0}, sz_date = {0,0}, sz_id = {0,0}, sz_beid = {0,0};
@@ -183,7 +58,7 @@ LOCAL W datlayout_res_calcresheaderdrawsize(datlayout_res_t *layout_res, GID gid
        W numstr_len, chwidth;
        H id_left = 0;
 
-       numstr_len = datlayout_res_UW_to_str(layout_res->index + 1, numstr);
+       numstr_len = tadlib_UW_to_str(layout_res->index + 1, numstr, 10);
 
        layoutstyle_resetgenvfont(gid);
        tadlib_calcdrawsize(numstr, numstr_len, gid, &sz_number, &alist_tmp);
@@ -286,47 +161,6 @@ LOCAL W datlayout_res_calcsize(datlayout_res_t *layout_res, datlayout_style_t *r
        return err;
 }
 
-EXPORT W datlayout_resindextotraytextdata(datlayout_t *layout, W n, B *data, W data_len)
-{
-       datlayout_res_t *res;
-       Bool exist;
-       exist = datlayoutarray_getresbyindex(layout->boxarray, n, &res);
-       if (exist == False) {
-               return -1; /* TODO */
-       }
-       return datlayout_res_totraytextdata(res, data, data_len);
-}
-
-EXPORT W datlayout_idtotraytextdata(datlayout_t *layout, TC *id, W id_len, B *data, W data_len)
-{
-       W i, len, result, sum = 0;
-       Bool haveid;
-       datlayout_res_t *res;
-
-       len = datlayoutarray_length(layout->boxarray);
-       for (i = 0; i < len; i++) {
-               datlayoutarray_getresbyindex(layout->boxarray, i, &res);
-
-               haveid = datlayout_res_issameid(res, id, id_len);
-               if (haveid == True) {
-                       if (data == NULL) {
-                               result = datlayout_res_totraytextdata(res, NULL, 0);
-                               if (result < 0) {
-                                       return result;
-                               }
-                       } else {
-                               result = datlayout_res_totraytextdata(res, data + sum, data_len - sum);
-                               if (result < 0) {
-                                       return result;
-                               }
-                       }
-                       sum += result;
-               }
-       }
-
-       return sum;
-}
-
 EXPORT W datlayout_appendres(datlayout_t *layout, datparser_res_t *parser_res)
 {
        datlayout_res_t *layout_res;
index d8f9be8..ce2988d 100644 (file)
@@ -44,7 +44,5 @@ IMPORT TC* datlayout_gettitle(datlayout_t *layout);
 IMPORT W datlayout_gettitlelen(datlayout_t *layout);
 IMPORT VOID datlayout_clear(datlayout_t *layout);
 IMPORT W datlayout_getthreadviewrectbyindex(datlayout_t *layout, W n, W *l, W *t, W *r, W *b);
-IMPORT W datlayout_resindextotraytextdata(datlayout_t *layout, W n, B *data, W data_len);
-IMPORT W datlayout_idtotraytextdata(datlayout_t *layout, TC *id, W id_len, B *data, W data_len);
 
 #endif
index a73ed97..b3b35c5 100644 (file)
@@ -50,6 +50,7 @@
 #include       "layoutstyle.h"
 #include       "layout.h"
 #include       "render.h"
+#include       "traydata.h"
 #include       "retriever.h"
 #include       "submit.h"
 #include       "tadurl.h"
@@ -162,6 +163,7 @@ struct bchan_t_ {
        datlayoutstyle_t style;
        datlayout_t *layout;
        datrender_t *render;
+       dattraydata_t *traydata;
        datwindow_t *window;
        ressubmit_t *submit;
        cfrmwindow_t *confirm;
@@ -727,12 +729,12 @@ LOCAL VOID bchan_butdn_pressnumber(bchan_t *bchan, WEVENT *wev, W resindex)
        gcnv_abs(bchan->gid, &pos);
        err = bchan_resnumbermenu_select(&bchan->resnumbermenu, pos);
        if (err == BCHAN_RESNUMBERMENU_SELECT_PUSHTRAY) {
-               size = datlayout_resindextotraytextdata(bchan->layout, resindex, NULL, 0);
+               size = dattraydata_resindextotraytextdata(bchan->traydata, resindex, NULL, 0);
                data = malloc(size);
                if (data == NULL) {
                        return;
                }
-               datlayout_resindextotraytextdata(bchan->layout, resindex, data, size);
+               dattraydata_resindextotraytextdata(bchan->traydata, resindex, data, size);
                bchan_pushstringtotray((TC*)data, size/2);
                free(data);
        } if (err == BCHAN_RESNUMBERMENU_SELECT_NG) {
@@ -794,12 +796,12 @@ LOCAL VOID bchan_butdn_pressresheaderid(bchan_t *bchan, WEVENT *wev, W resindex)
        gcnv_abs(bchan->gid, &pos);
        err = bchan_residmenu_select(&bchan->residmenu, pos);
        if (err == BCHAN_RESIDMENU_SELECT_PUSHTRAY) {
-               size = datlayout_idtotraytextdata(bchan->layout, id, id_len, NULL, 0);
+               size = dattraydata_idtotraytextdata(bchan->traydata, id, id_len, NULL, 0);
                data = malloc(size);
                if (data == NULL) {
                        return;
                }
-               datlayout_idtotraytextdata(bchan->layout, id, id_len, data, size);
+               dattraydata_idtotraytextdata(bchan->traydata, id, id_len, data, size);
                bchan_pushstringtotray((TC*)data, size/2);
                free(data);
        } if (err == BCHAN_RESIDMENU_SELECT_NG) {
@@ -1087,6 +1089,7 @@ LOCAL W bchan_initialize(bchan_t *bchan, VID vid, WID wid, W exectype)
        datlayoutarray_t *layoutarray;
        datlayout_t *layout;
        datrender_t *render;
+       dattraydata_t *traydata;
        datwindow_t *window;
        datretriever_t *retriever;
        ressubmit_t *submit;
@@ -1125,6 +1128,11 @@ LOCAL W bchan_initialize(bchan_t *bchan, VID vid, WID wid, W exectype)
                DP_ER("datrender_new error", 0);
                goto error_render;
        }
+       traydata = dattraydata_new(layoutarray);
+       if (traydata == NULL) {
+               DP_ER("dattraydata_new error", 0);
+               goto error_traydata;
+       }
        window = datwindow_new(wid, bchan_scroll, bchan_draw, bchan_resize, bchan_close, bchan_butdn, bchan_paste, bchan);
        if (window == NULL) {
                DP_ER("datwindow_new error", 0);
@@ -1195,6 +1203,7 @@ LOCAL W bchan_initialize(bchan_t *bchan, VID vid, WID wid, W exectype)
        bchan->layoutarray = layoutarray;
        bchan->layout = layout;
        bchan->render = render;
+       bchan->traydata = traydata;
        bchan->window = window;
        bchan->retriever = retriever;
        bchan->submit = submit;
@@ -1221,6 +1230,8 @@ error_submit:
 error_retriever:
        datwindow_delete(window);
 error_window:
+       dattraydata_delete(traydata);
+error_traydata:
        datrender_delete(render);
 error_render:
        datlayout_delete(layout);
index be0b43c..f71dd5b 100644 (file)
@@ -114,43 +114,15 @@ LOCAL W datrender_entrydraw_drawdateidbeid(datlayout_res_t *entry, GID gid, W dh
 #endif
 }
 
-LOCAL TC dec[] = {TK_0,TK_1,TK_2,TK_3,TK_4,TK_5,TK_6,TK_7,TK_8,TK_9}; /* TODO: layout.c */
-
 LOCAL W datrender_entrydraw_resnumber(datlayout_res_t *entry, W resnum, GID target)
 {
-       W err,digit,draw = 0;
+       W err,numstr_len;
+       TC numstr[10];
 
-       digit = resnum / 1000 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               err = gdra_chr(target, dec[digit], G_STORE);
-               if (err < 0) {
-                       return err;
-               }
-               draw = 1;
-       }
-       digit = resnum / 100 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               err = gdra_chr(target, dec[digit], G_STORE);
-               if (err < 0) {
-                       return err;
-               }
-               draw = 1;
-       }
-       digit = resnum / 10 % 10;
-       if ((digit != 0)||(draw != 0)) {
-               err = gdra_chr(target, dec[digit], G_STORE);
-               if (err < 0) {
-                       return err;
-               }
-               draw = 1;
-       }
-       digit = resnum % 10;
-       if ((digit != 0)||(draw != 0)) {
-               err = gdra_chr(target, dec[digit], G_STORE);
-               if (err < 0) {
-                       return err;
-               }
-               draw = 1;
+       numstr_len = tadlib_UW_to_str(resnum, numstr, 10);
+       err = gdra_str(target, numstr, numstr_len, G_STORE);
+       if (err < 0) {
+               return err;
        }
 
        return 0;
index f70fae7..06f6efd 100644 (file)
@@ -689,6 +689,41 @@ EXPORT W tadlib_remove_TA_APPL(TC *str, W len, TC *data, W data_len)
        return i;
 }
 
+LOCAL TC dec[] = {TK_0,TK_1,TK_2,TK_3,TK_4,TK_5,TK_6,TK_7,TK_8,TK_9};
+
+EXPORT W tadlib_UW_to_str(UW val, TC *dest, W dest_len)
+{
+       W i = 0, digit, draw = 0;
+       TC dummy_str[10];
+
+       if (dest == NULL) {
+               dest = dummy_str;
+       }
+
+       digit = val / 1000 % 10;
+       if ((digit != 0)||(draw != 0)) {
+               dest[i++] = dec[digit];
+               draw = 1;
+       }
+       digit = val / 100 % 10;
+       if ((digit != 0)||(draw != 0)) {
+               dest[i++] = dec[digit];
+               draw = 1;
+       }
+       digit = val / 10 % 10;
+       if ((digit != 0)||(draw != 0)) {
+               dest[i++] = dec[digit];
+               draw = 1;
+       }
+       digit = val % 10;
+       if ((digit != 0)||(draw != 0)) {
+               dest[i++] = dec[digit];
+               draw = 1;
+       }
+
+       return i;
+}
+
 EXPORT VOID tadlib_separete_datepart(TC *str, W len, TC **date, W *date_len, TC **id, W *id_len, TC **beid, W *beid_len)
 {
        taditerator_t iter;
index 9fd4416..243b802 100644 (file)
@@ -45,6 +45,7 @@ IMPORT W tadlib_calcdrawsize(TC *str, W len, GID gid, SIZE *sz, actionlist_t **a
 IMPORT W tadlib_drawtext(TC *str, W len, GID gid, W dh, W dv);
 IMPORT W tadlib_remove_TA_APPL_calcsize(TC *str, W len);
 IMPORT W tadlib_remove_TA_APPL(TC *str, W len, TC *dest, W dest_len);
+IMPORT W tadlib_UW_to_str(UW val, TC *dest, W dest_len);
 IMPORT VOID tadlib_separete_datepart(TC *str, W len, TC **date, W *date_len, TC **id, W *id_len, TC **beid, W *beid_len);
 
 struct taditerator_t_ {
diff --git a/src/traydata.c b/src/traydata.c
new file mode 100644 (file)
index 0000000..b119981
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * traydata.c
+ *
+ * Copyright (c) 2010 project bchan
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ */
+
+#include    "traydata.h"
+#include    "layoutarray.h"
+#include    "tadlib.h"
+
+#include       <basic.h>
+#include       <bstdlib.h>
+#include       <bstdio.h>
+#include       <tcode.h>
+
+#ifdef BCHAN_CONFIG_DEBUG
+# define DP(arg) printf arg
+# define DP_ER(msg, err) printf("%s (%d/%x)\n", msg, err>>16, err)
+#else
+# define DP(arg) /**/
+# define DP_ER(msg, err) /**/
+#endif
+
+struct dattraydata_t_ {
+       datlayoutarray_t *layoutarray;
+};
+
+LOCAL W datlayout_res_totraytextdata_write_zenkaku(TC *str)
+{
+       TADSEG *seg = (TADSEG*)str;
+
+       if (str == NULL) {
+               return 10;
+       }
+
+       seg->id = 0xFF00|TS_TFONT;
+       seg->len = 6;
+       *(UH*)(str + 2) = 3 << 8;
+       *(RATIO*)(str + 3) = 0x0101;
+       *(RATIO*)(str + 4) = 0x0101;
+
+       return 10;
+}
+
+LOCAL W datlayout_res_totraytextdata(datlayout_res_t *res, B *data, W data_len)
+{
+       W i = 0, num;
+       TC *str = (TC*)data;
+
+       if (data != NULL) {
+               num = res->index + 1;
+               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
+               i += tadlib_UW_to_str(num, str + i, data_len - i / 2);
+               str[i++] = TK_KSP;
+               i += tadlib_remove_TA_APPL(res->parser_res->name, res->parser_res->name_len, str + i, data_len - i / 2) / 2;
+               str[i++] = TK_KSP;
+               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
+               str[i++] = TK_LABR;
+               i += tadlib_remove_TA_APPL(res->parser_res->mail, res->parser_res->mail_len, str + i, data_len - i / 2) / 2;
+               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
+               str[i++] = TK_RABR;
+               str[i++] = TK_KSP;
+               i += tadlib_remove_TA_APPL(res->parser_res->date, res->parser_res->date_len, str + i, data_len - i / 2) / 2;
+               str[i++] = TK_NL;
+               i += datlayout_res_totraytextdata_write_zenkaku(str + i) / 2;
+               i += tadlib_remove_TA_APPL(res->parser_res->body, res->parser_res->body_len, str + i, data_len - i / 2) / 2;
+               str[i++] = TK_NL;
+       } else {
+               num = res->index + 1;
+               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
+               i += tadlib_UW_to_str(num, NULL, 0);
+               i++; /* TK_KSP */
+               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->name, res->parser_res->name_len) / 2;
+               i++; /* TK_KSP */
+               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
+               i++; /* TO_LABR */
+               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->mail, res->parser_res->mail_len) / 2;
+               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
+               i++; /* TO_RABR */
+               i++; /* TK_KSP */
+               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->date, res->parser_res->date_len) / 2;
+               i++; /* TK_NL */
+               i += datlayout_res_totraytextdata_write_zenkaku(NULL) / 2;
+               i += tadlib_remove_TA_APPL_calcsize(res->parser_res->body, res->parser_res->body_len) / 2;
+               i++; /* TK_NL */
+       }
+
+       return i * sizeof(TC);
+}
+
+EXPORT W dattraydata_resindextotraytextdata(dattraydata_t *traydata, W n, B *data, W data_len)
+{
+       datlayout_res_t *res;
+       Bool exist;
+       exist = datlayoutarray_getresbyindex(traydata->layoutarray, n, &res);
+       if (exist == False) {
+               return -1; /* TODO */
+       }
+       return datlayout_res_totraytextdata(res, data, data_len);
+}
+
+EXPORT W dattraydata_idtotraytextdata(dattraydata_t *traydata, TC *id, W id_len, B *data, W data_len)
+{
+       W i, len, result, sum = 0;
+       Bool haveid;
+       datlayout_res_t *res;
+
+       len = datlayoutarray_length(traydata->layoutarray);
+       for (i = 0; i < len; i++) {
+               datlayoutarray_getresbyindex(traydata->layoutarray, i, &res);
+
+               haveid = datlayout_res_issameid(res, id, id_len);
+               if (haveid == True) {
+                       if (data == NULL) {
+                               result = datlayout_res_totraytextdata(res, NULL, 0);
+                               if (result < 0) {
+                                       return result;
+                               }
+                       } else {
+                               result = datlayout_res_totraytextdata(res, data + sum, data_len - sum);
+                               if (result < 0) {
+                                       return result;
+                               }
+                       }
+                       sum += result;
+               }
+       }
+
+       return sum;
+}
+
+EXPORT dattraydata_t* dattraydata_new(datlayoutarray_t *layoutarray)
+{
+       dattraydata_t *traydata;
+
+       traydata = (dattraydata_t *)malloc(sizeof(dattraydata_t));
+       if (traydata == NULL) {
+               return NULL;
+       }
+       traydata->layoutarray = layoutarray;
+
+       return traydata;
+}
+
+EXPORT VOID dattraydata_delete(dattraydata_t *traydata)
+{
+       free(traydata);
+}
diff --git a/src/traydata.h b/src/traydata.h
new file mode 100644 (file)
index 0000000..504fe5d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * traydata.h
+ *
+ * Copyright (c) 2010 project bchan
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ */
+
+#include    <basic.h>
+
+#include    "layoutarray.h"
+
+#ifndef __TRAYDATA_H__
+#define __TRAYDATA_H__
+
+typedef struct dattraydata_t_ dattraydata_t;
+
+IMPORT dattraydata_t* dattraydata_new(datlayoutarray_t *layoutarray);
+IMPORT VOID dattraydata_delete(dattraydata_t *traydata);
+IMPORT W dattraydata_resindextotraytextdata(dattraydata_t *traydata, W n, B *data, W data_len);
+IMPORT W dattraydata_idtotraytextdata(dattraydata_t *traydata, TC *id, W id_len, B *data, W data_len);
+
+#endif