OSDN Git Service

add thread info panel.
authorornse01 <ornse01@users.sourceforge.jp>
Sun, 21 Mar 2010 08:21:52 +0000 (08:21 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Sun, 21 Mar 2010 08:21:52 +0000 (08:21 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@72 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/Makefile
src/bchan.d
src/bchan_panels.c [new file with mode: 0644]
src/bchan_panels.h [new file with mode: 0644]
src/main.c

index b58102b..f3615ee 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
+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
 
 # ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
 DBSRC =
index 2e86a1d..fe80d64 100644 (file)
 .FFUSEN_VIEWER         =       36
 .MSGTEXT_NOTFOUND      =       37
 .TEXT_MLIST3   =       38
+.MS_PANEL_OK   =       39
+.TEXT_SERVERNAME       =       40
+.TEXT_BOARDNAME        =       41
+.TEXT_THREADNUMBER     =       42
+.TEXT_THREADINFO       =       43
 
 ---------
 -- data type = PARTS_DATA
        {0L 0L -1L 0L}          -- PARTDISP
        MC_STR "¼è¤ê¾Ã¤·\0"
 
+       {# MS_PANEL_OK 0 0}     -- data number
+       MS_PARTS+P_DISP:L       -- type
+       {0H 0H 80H 24H} -- r
+       0L                      -- cv (unused)
+       OFFSET:L+20             -- name ()
+       {0L 0L -1L 0L}          -- PARTDISP
+       MC_STR "³Îǧ\0"
+
 ---------
 -- data type = TEXT_DATA
 ---------
@@ -79,7 +92,9 @@
        MC_STR+MC_STRKEY1 "£Å½ªÎ»\0"
 
        {# TEXT_MLIST1 0 0}     -- data number
-       MC_STR "ɽ¼¨" MC_STR "ºÆɽ¼¨\0"
+       MC_STR "ɽ¼¨"
+       MC_STR "ºÆɽ¼¨"
+       MC_STR "¥¹¥ì¥Ã¥É¾ðÊó¤òɽ¼¨\0"
 
        {# TEXT_MLIST2 0 0}     -- data number
        MC_STR "Áàºî"
        {# MSGTEXT_NOTFOUND 0 0}        -- data number
        "¥¹¥ì¥Ã¥É¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿\0"
 
+       {# TEXT_SERVERNAME 0 0} -- data number
+       "¥µ¡¼¥Ð¡¼Ì¾¡§\0"
+
+       {# TEXT_BOARDNAME 0 0}  -- data number
+       "ÈÄ̾¡§\0"
+
+       {# TEXT_THREADNUMBER 0 0}       -- data number
+       "¥¹¥ì¥Ã¥ÉÈֹ桧\0"
+
+       {# TEXT_THREADINFO 0 0} -- data number
+       "¥¹¥ì¥Ã¥É¾ðÊó\0"
+
 ---------
 -- data type = MENU_DATA
 ---------
diff --git a/src/bchan_panels.c b/src/bchan_panels.c
new file mode 100644 (file)
index 0000000..f0a1513
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * bchan_panels.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    "bchan_panels.h"
+
+#include       <basic.h>
+#include       <bstdio.h>
+#include       <bstdlib.h>
+#include       <btron/hmi.h>
+#include       <btron/vobj.h>
+#include       "sjisstring.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
+
+#define BCHAN_DBX_MS_PANEL_OK 39
+#define BCHAN_DBX_TEXT_SERVERNAME 40
+#define BCHAN_DBX_TEXT_BOARDNAME 41
+#define BCHAN_DBX_TEXT_THREADNUMBER 42
+#define BCHAN_DBX_TEXT_THREADINFO 43
+
+EXPORT W bchan_panels_threadinfo_tc(TC *host, W host_len, TC *board, W board_len, TC *thread, W thread_len)
+{
+       PNL_ITEM pnl_item[8];
+       PNID pnid0;
+       PNT p0 = {0x8000,0x8000};
+       WEVENT wev0;
+       W stat,itemno;
+       PANEL pnl = {
+               2,0x48,0,
+               {{0, 0, 436, 188}},
+               1,
+               8,
+               pnl_item
+       };
+
+       pnl_item[0].itype = PARTS_ITEM;
+       pnl_item[0].info = 0;
+       pnl_item[0].ir = (RECT){{178,140,0,0}};
+       pnl_item[0].desc = 0;
+       pnl_item[0].dnum = BCHAN_DBX_MS_PANEL_OK;
+       pnl_item[0].ptr = NULL;
+       pnl_item[1].itype = TEXT_ITEM;
+       pnl_item[1].info = 0;
+       pnl_item[1].ir = (RECT){{24,50,0,0}};
+       pnl_item[1].desc = 0;
+       pnl_item[1].dnum = BCHAN_DBX_TEXT_SERVERNAME;
+       pnl_item[1].ptr = NULL;
+       pnl_item[2].itype = TEXT_ITEM;
+       pnl_item[2].info = 0;
+       pnl_item[2].ir = (RECT){{24,80,0,0}};
+       pnl_item[2].desc = 0;
+       pnl_item[2].dnum = BCHAN_DBX_TEXT_BOARDNAME;
+       pnl_item[2].ptr = NULL;
+       pnl_item[3].itype = TEXT_ITEM;
+       pnl_item[3].info = 0;
+       pnl_item[3].ir = (RECT){{24,110,0,0}};
+       pnl_item[3].desc = 0;
+       pnl_item[3].dnum = BCHAN_DBX_TEXT_THREADNUMBER;
+       pnl_item[3].ptr = NULL;
+       pnl_item[4].itype = TEXT_ITEM;
+       pnl_item[4].info = 0;
+       pnl_item[4].ir = (RECT){{170,24,0,0}};
+       pnl_item[4].desc = 0;
+       pnl_item[4].dnum = BCHAN_DBX_TEXT_THREADINFO;
+       pnl_item[4].ptr = NULL;
+       pnl_item[5].itype = TEXT_ITEM|ATR_TEXT;
+       pnl_item[5].info = 0;
+       pnl_item[5].ir = (RECT){{120,50,0,0}};
+       pnl_item[5].desc = 0;
+       pnl_item[5].dnum = 0;
+       pnl_item[5].ptr = (H*)host;
+       pnl_item[6].itype = TEXT_ITEM|ATR_TEXT;
+       pnl_item[6].info = 0;
+       pnl_item[6].ir = (RECT){{68,80,0,0}};
+       pnl_item[6].desc = 0;
+       pnl_item[6].dnum = 0;
+       pnl_item[6].ptr = (H*)board;
+       pnl_item[7].itype = TEXT_ITEM|ATR_TEXT;
+       pnl_item[7].info = 0;
+       pnl_item[7].ir = (RECT){{136,110,0,0}};
+       pnl_item[7].desc = 0;
+       pnl_item[7].dnum = 0;
+       pnl_item[7].ptr = (H*)thread;
+
+       pnid0 = pcre_pnl(&pnl, &p0);
+       if (pnid0 < 0) {
+               DP_ER("pcre_pnl error", pnid0);
+               return pnid0;
+       }
+
+       for (;;) {
+               stat = pact_pnl(pnid0, &wev0.e, &itemno);
+               switch (stat) {
+               case    P_EVENT:
+                       if (wev0.s.type == EV_DEVICE) {
+                               oprc_dev(&wev0.e, NULL, 0);
+                       }
+                       continue;
+               default:
+                       if (itemno == 1) { /* default switch */
+                               break;
+                       }
+                       if (itemno >= 0) {
+                               continue;
+                       }
+               case    0x5001:
+                       if (itemno == 1) { /* default switch */
+                               break;
+                       }
+                       if (itemno >= 0) {
+                               continue;
+                       }
+                       break;
+               }
+               if (itemno == 1) { /* default switch */
+                       break;
+               }
+       }
+
+       pdel_pnl(pnid0);
+
+       return 0;
+}
+
+EXPORT W bchan_panels_threadinfo(UB *host, W host_len, UB *board, W board_len, UB *thread, W thread_len)
+{
+       TC *host_tc, *board_tc, *thread_tc;
+       W host_tc_len, board_tc_len, thread_tc_len;
+       W err;
+
+       host_tc_len = sjstring_totcs(host, host_len, NULL);
+       if (host_tc_len < 0) {
+               return -1; /* TODO */
+       }
+       host_tc = malloc(sizeof(TC)*(host_tc_len + 1));
+       if (host_tc == NULL) {
+               return -1; /* TODO */
+       }
+       sjstring_totcs(host, host_len, host_tc);
+       host_tc[host_tc_len] = TNULL;
+       board_tc_len = sjstring_totcs(board, board_len, NULL);
+       if (board_tc_len < 0) {
+               free(host_tc);
+               return -1; /* TODO */
+       }
+       board_tc = malloc(sizeof(TC)*(board_tc_len + 1));
+       if (board_tc == NULL) {
+               free(host_tc);
+               return -1; /* TODO */
+       }
+       sjstring_totcs(board, board_len, board_tc);
+       board_tc[board_tc_len] = TNULL;
+       thread_tc_len = sjstring_totcs(thread, thread_len, NULL);
+       if (thread_tc_len < 0) {
+               free(board_tc);
+               free(host_tc);
+               return -1; /* TODO */
+       }
+       thread_tc = malloc(sizeof(TC)*(thread_tc_len + 1));
+       if (thread_tc == NULL) {
+               free(board_tc);
+               free(host_tc);
+               return -1; /* TODO */
+       }
+       sjstring_totcs(thread, thread_len, thread_tc);
+       thread_tc[thread_tc_len] = TNULL;
+
+       err = bchan_panels_threadinfo_tc(host_tc, host_tc_len, board_tc, board_tc_len, thread_tc, thread_tc_len);
+
+       free(thread_tc);
+       free(board_tc);
+       free(host_tc);
+
+       return err;
+}
diff --git a/src/bchan_panels.h b/src/bchan_panels.h
new file mode 100644 (file)
index 0000000..74680ba
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * bchan_panels.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>
+
+#ifndef __BCHAN_PANELS_H__
+#define __BCHAN_PANELS_H__
+
+IMPORT W bchan_panels_threadinfo(UB *host, W host_len, UB *board, W board_len, UB *thread, W thread_len);
+
+#endif
index 396d859..c90db7c 100644 (file)
@@ -52,6 +52,7 @@
 #include       "tadurl.h"
 #include       "sjisstring.h"
 #include       "bchan_vobj.h"
+#include       "bchan_panels.h"
 
 #ifdef BCHAN_CONFIG_DEBUG
 # define DP(arg) printf arg
@@ -1228,6 +1229,9 @@ LOCAL VOID bchan_setupmenu(bchan_t *bchan)
 
 LOCAL VOID bchan_selectmenu(bchan_t *bchan, W i)
 {
+       UB *host, *board, *thread;
+       W host_len, board_len, thread_len;
+
        switch(i >> 8) {
        case 0: /* [½ªÎ»] */
                killme(bchan);
@@ -1237,6 +1241,12 @@ LOCAL VOID bchan_selectmenu(bchan_t *bchan, W i)
                case 1: /* [ºÆɽ¼¨] */
                        wreq_dsp(bchan->wid);
                        break;
+               case 2: /* [¥¹¥ì¥Ã¥É¾ðÊó¤òɽ¼¨] */
+                       datcache_gethost(bchan->cache, &host, &host_len);
+                       datcache_getborad(bchan->cache, &board, &board_len);
+                       datcache_getthread(bchan->cache, &thread, &thread_len);
+                       bchan_panels_threadinfo(host, host_len, board, board_len, thread, thread_len);
+                       break;
                }
                break;
        case 2: /* [Áàºî] */