OSDN Git Service

separate files for wordlist.
authorornse01 <ornse01@users.sourceforge.jp>
Mon, 10 Jan 2011 12:58:15 +0000 (12:58 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Mon, 10 Jan 2011 12:58:15 +0000 (12:58 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@193 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/Makefile
src/Makefile.test
src/hmi.c
src/test_wordlist.c [new file with mode: 0644]
src/wordlist.c [new file with mode: 0644]
src/wordlist.h [new file with mode: 0644]

index cc9f053..f78071b 100644 (file)
@@ -38,7 +38,7 @@ VPATH = $(S)
 HEADER := $(S) $(HEADER)
 
 # ¥½¡¼¥¹¥Õ¥¡¥¤¥ë
-SRC =  main.c cache.c parser.c layout.c retriever.c tadlib.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 hmi.c
+SRC =  main.c cache.c parser.c layout.c retriever.c tadlib.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 hmi.c wordlist.c
 
 # ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
 DBSRC =
index 3661741..7d1e393 100644 (file)
@@ -38,7 +38,7 @@ VPATH = $(S)
 HEADER := $(S) $(HEADER)
 
 # ¥½¡¼¥¹¥Õ¥¡¥¤¥ë
-SRC =  test_main.c cache.c test_cache.c parser.c test_parser.c layout.c test_layout.c retriever.c tadlib.c parselib.c test_parselib.c http.c submitutil.c test_submitutil.c sjisstring.c test_sjisstring.c residhash.c test_residhash.c resindexhash.c test_resindexhash.c postres.c test_postres.c tadimf.c test_tadimf.c array.c test_array.c layoutarray.c test_layoutarray.c layoutstyle.c
+SRC =  test_main.c cache.c test_cache.c parser.c test_parser.c layout.c test_layout.c retriever.c tadlib.c parselib.c test_parselib.c http.c submitutil.c test_submitutil.c sjisstring.c test_sjisstring.c residhash.c test_residhash.c resindexhash.c test_resindexhash.c postres.c test_postres.c tadimf.c test_tadimf.c array.c test_array.c layoutarray.c test_layoutarray.c layoutstyle.c wordlist.c test_wordlist.c
 
 # ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
 DBSRC =
index a6c2c09..b383755 100644 (file)
--- a/src/hmi.c
+++ b/src/hmi.c
@@ -26,6 +26,7 @@
 
 #include    "hmi.h"
 #include       "tadlib.h"
+#include       "wordlist.h"
 
 #include       <bstdio.h>
 #include       <bstdlib.h>
@@ -34,7 +35,6 @@
 #include       <btron/btron.h>
 #include       <btron/hmi.h>
 #include       <btron/vobj.h>
-#include       <bsys/queue.h>
 
 #ifdef BCHAN_CONFIG_DEBUG
 # define DP(arg) printf arg
@@ -354,51 +354,6 @@ LOCAL VOID windowscroll_finalize(windowscroll_t *wscr)
 {
 }
 
-struct ngwordlist_node_t_ {
-       QUEUE queue;
-       TC *str;
-       W len;
-};
-typedef struct ngwordlist_node_t_ ngwordlist_node_t;
-
-LOCAL ngwordlist_node_t* ngwordlist_node_new(TC *str, W strlen)
-{
-       ngwordlist_node_t *node;
-
-       node = (ngwordlist_node_t*)malloc(sizeof(ngwordlist_node_t));
-       if (node == NULL) {
-               return NULL;
-       }
-
-       node->str = malloc(sizeof(TC)*strlen);
-       if (node->str == NULL) {
-               free(node);
-               return NULL;
-       }
-       memcpy(node->str, str, sizeof(TC)*strlen);
-       node->len = strlen;
-       QueInit(&(node->queue));
-
-       return node;
-}
-
-LOCAL VOID ngwordlist_node_delete(ngwordlist_node_t *node)
-{
-       QueRemove(&(node->queue));
-       free(node->str);
-       free(node);
-}
-
-LOCAL VOID ngwordlist_node_insert(ngwordlist_node_t *entry, ngwordlist_node_t *node)
-{
-       QueInsert(&(entry->queue), &(node->queue));
-}
-
-LOCAL ngwordlist_node_t* ngwordlist_node_next(ngwordlist_node_t *node)
-{
-       return (ngwordlist_node_t *)(node->queue.next);
-}
-
 struct datwindow_t_ {
        WID wid;
        GID gid;
diff --git a/src/test_wordlist.c b/src/test_wordlist.c
new file mode 100644 (file)
index 0000000..95b833d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * test_wordlist.c
+ *
+ * Copyright (c) 201a 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    <btron/btron.h>
+#include    <bstdio.h>
+#include    <tcode.h>
+
+#include    "test.h"
+
+#include    "wordlist.h"
diff --git a/src/wordlist.c b/src/wordlist.c
new file mode 100644 (file)
index 0000000..76c4d82
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * wordlist.c
+ *
+ * Copyright (c) 2011 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    "wordlist.h"
+
+#include       <bstdio.h>
+#include       <bstdlib.h>
+#include       <bsys/queue.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
+
+EXPORT VOID ngwordlist_node_insert(ngwordlist_node_t *entry, ngwordlist_node_t *node)
+{
+       QueInsert(&(entry->queue), &(node->queue));
+}
+
+EXPORT ngwordlist_node_t* ngwordlist_node_next(ngwordlist_node_t *node)
+{
+       return (ngwordlist_node_t *)(node->queue.next);
+}
+
+EXPORT ngwordlist_node_t* ngwordlist_node_new(TC *str, W strlen)
+{
+       ngwordlist_node_t *node;
+
+       node = (ngwordlist_node_t*)malloc(sizeof(ngwordlist_node_t));
+       if (node == NULL) {
+               return NULL;
+       }
+
+       node->str = malloc(sizeof(TC)*strlen);
+       if (node->str == NULL) {
+               free(node);
+               return NULL;
+       }
+       memcpy(node->str, str, sizeof(TC)*strlen);
+       node->len = strlen;
+       QueInit(&(node->queue));
+
+       return node;
+}
+
+EXPORT VOID ngwordlist_node_delete(ngwordlist_node_t *node)
+{
+       QueRemove(&(node->queue));
+       free(node->str);
+       free(node);
+}
diff --git a/src/wordlist.h b/src/wordlist.h
new file mode 100644 (file)
index 0000000..1c7b96b
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * wordlist.h
+ *
+ * Copyright (c) 2011 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       <bsys/queue.h>
+
+#ifndef __WORDLIST_H__
+#define __WORDLIST_H__
+
+struct ngwordlist_node_t_ {
+       QUEUE queue;
+       TC *str;
+       W len;
+};
+typedef struct ngwordlist_node_t_ ngwordlist_node_t;
+
+IMPORT ngwordlist_node_t* ngwordlist_node_new(TC *str, W strlen);
+IMPORT VOID ngwordlist_node_delete(ngwordlist_node_t *node);
+IMPORT VOID ngwordlist_node_insert(ngwordlist_node_t *entry, ngwordlist_node_t *node);
+IMPORT ngwordlist_node_t* ngwordlist_node_next(ngwordlist_node_t *node);
+
+#endif