• R/O
  • SSH
  • HTTPS

npl: コミット


コミットメタ情報

リビジョン33 (tree)
日時2017-08-21 04:50:52
作者tamiya25

ログメッセージ

文字列のバッファ処理を変更

変更サマリ

差分

--- trunk/npl/mbstr.c (revision 32)
+++ trunk/npl/mbstr.c (revision 33)
@@ -1,57 +1,62 @@
11 #include "global.h"
22
3-int npl_mbstr_init(npl_mbstr_t *str, const char *s)
3+struct npl_mbstr_t {
4+ npl_object_t object;
5+ char *str;
6+};
7+
8+npl_mbstr_t* npl_mbstr_new(const char *s)
49 {
5- assert(str);
6- assert(s);
10+ size_t obj_size;
11+ size_t len, str_size;
12+ npl_mbstr_t *str;
713
8- str->str = strdup(s);
9- if (str->str == NULL)
10- return 1; // error
11-
12- return 0;
13-}
14-
15-int npl_mbstr_init_from_wcs(npl_mbstr_t *str, const wchar_t *s)
16-{
17- assert(str);
1814 assert(s);
1915
20- str->str = npl_convert_to_mbs(s);
21- if (str->str == NULL)
22- return 1; // error
16+ // 文字列サイズを計算
17+ len = strlen(s);
18+ len += 1;
19+ if (len < 1)
20+ return NULL;
21+ if (len > (SIZE_MAX / sizeof(char)))
22+ return NULL;
23+ str_size = len * sizeof(char);
2324
24- return 0;
25-}
25+ // オブジェクトサイズを計算
26+ obj_size = str_size + sizeof(npl_mbstr_t);
27+ if (obj_size < sizeof(npl_mbstr_t))
28+ return NULL;
2629
27-npl_mbstr_t* npl_mbstr_new(const char *s)
28-{
29- npl_object_t *object;
30-
31- object = npl_object_new(npl_mbstr_type);
32- if (object == NULL)
30+ // オブジェクト初期化
31+ str = malloc(obj_size);
32+ if (str == NULL)
3333 return NULL;
34- if (npl_mbstr_init(NPL_MBSTR(object), s)) {
35- npl_object_unref(object);
34+ memset(str, 0, obj_size);
35+ if (npl_object_init(&str->object, npl_mbstr_type)) {
36+ free(str);
3637 return NULL;
3738 }
39+ str->str = (void*)(str + 1);
3840
39- return NPL_MBSTR(object);
41+ // 文字列コピー
42+ strcpy(str->str, s);
43+
44+ return str;
45+
4046 }
4147
4248 npl_mbstr_t* npl_mbstr_new_from_wcs(const wchar_t *s)
4349 {
44- npl_object_t *object;
50+ npl_mbstr_t *str;
51+ char *mbs;
4552
46- object = npl_object_new(npl_mbstr_type);
47- if (object == NULL)
53+ mbs = npl_convert_to_mbs(s);
54+ if (mbs == NULL)
4855 return NULL;
49- if (npl_mbstr_init_from_wcs(NPL_MBSTR(object), s)) {
50- npl_object_unref(object);
51- return NULL;
52- }
5356
54- return NPL_MBSTR(object);
57+ str = npl_mbstr_new(mbs);
58+ free(mbs);
59+ return str;
5560 }
5661
5762 char* npl_mbstr_get(npl_mbstr_t *str)
@@ -60,16 +65,6 @@
6065 return str->str;
6166 }
6267
63-static void _destructor(npl_object_t *object)
64-{
65- npl_mbstr_t *s = NPL_MBSTR(object);
66-
67- if (s->str != NULL) {
68- free(s->str);
69- s->str = NULL;
70- }
71-}
72-
7368 npl_type_t _npl_mbstr_type = {
7469 .object = {
7570 .type = &_npl_type_type,
@@ -77,9 +72,9 @@
7772 .static_flag = 1,
7873 },
7974 .name = L"mbstr",
80- .destructor = _destructor,
75+ .destructor = NULL,
8176 .parent = &_npl_object_type,
82- .size = sizeof(npl_mbstr_t),
77+ .size = 0,
8378 };
8479
8580 npl_type_t *npl_mbstr_type = &_npl_mbstr_type;
--- trunk/npl/npl.h (revision 32)
+++ trunk/npl/npl.h (revision 33)
@@ -52,6 +52,7 @@
5252 int static_flag;
5353 };
5454
55+int npl_object_init(npl_object_t *object, npl_type_t *type);
5556 npl_object_t* npl_object_new(npl_type_t *type);
5657 void npl_object_ref(npl_object_t *object);
5758 void npl_object_unref(npl_object_t *object);
@@ -86,13 +87,6 @@
8687
8788 // str class
8889 // str はワイド文字の文字列。
89-struct npl_str_t {
90- npl_object_t object;
91- wchar_t *str;
92-};
93-
94-int npl_str_init(npl_str_t *str, const wchar_t *s);
95-int npl_str_init_from_mbs(npl_str_t *str, const char *s);
9690 npl_str_t* npl_str_new(const wchar_t *s);
9791 npl_str_t* npl_str_new_from_mbs(const char *s);
9892 wchar_t* npl_str_get(npl_str_t *s);
@@ -99,13 +93,6 @@
9993
10094 // mbstr class
10195 // mbstr はマルチバイト文字の文字列。
102-struct npl_mbstr_t {
103- npl_object_t object;
104- char *str;
105-};
106-
107-int npl_mbstr_init(npl_mbstr_t *str, const char *s);
108-int npl_mbstr_init_from_wcs(npl_mbstr_t *str, const wchar_t *s);
10996 npl_mbstr_t* npl_mbstr_new(const char *s);
11097 npl_mbstr_t* npl_mbstr_new_from_wcs(const wchar_t *s);
11198 char* npl_mbstr_get(npl_mbstr_t *str);
@@ -112,10 +99,24 @@
11299
113100 // sbuf class
114101 // StringBuffer
102+struct npl_sbuf_t {
103+ npl_object_t object;
104+
105+ // buf のワイド文字数(バイト数でなく)
106+ size_t bufsize;
107+
108+ // ワイド文字列バッファへのポインタ
109+ wchar_t *buf;
110+};
111+
112+int npl_sbuf_init(npl_sbuf_t *sb);
115113 npl_sbuf_t* npl_sbuf_new(void);
116114 int npl_sbuf_add(npl_sbuf_t *sb, const wchar_t *s);
117115 npl_str_t* npl_sbuf_get(npl_sbuf_t *sb);
118116 void npl_sbuf_clear(npl_sbuf_t *sb);
117+wchar_t* npl_sbuf_get_buf(npl_sbuf_t *sb);
118+size_t npl_sbuf_get_bufsize(npl_sbuf_t *sb);
119+int npl_sbuf_change_bufsize(npl_sbuf_t *sb, size_t bufsize);
119120
120121 // stream class
121122 struct npl_stream_t {
--- trunk/npl/object.c (revision 32)
+++ trunk/npl/object.c (revision 33)
@@ -9,18 +9,34 @@
99 call_destructor(object, type->parent);
1010 }
1111
12+int npl_object_init(npl_object_t *object, npl_type_t *type)
13+{
14+ assert(object);
15+ assert(type);
16+
17+ object->type = type;
18+ object->ref_count = 0;
19+ object->static_flag = 0;
20+ npl_object_ref(object);
21+
22+ return 0;
23+}
24+
1225 npl_object_t* npl_object_new(npl_type_t *type)
1326 {
1427 npl_object_t *object;
1528
1629 assert(type);
30+ assert(type->size != 0);
1731
1832 object = malloc(type->size);
1933 if (object == NULL)
2034 return NULL; // error
2135 memset(object, 0, type->size);
22- object->type = type;
23- npl_object_ref(object);
36+ if (npl_object_init(object, type)) {
37+ free(object);
38+ return NULL; // error;
39+ }
2440
2541 return object;
2642 }
--- trunk/npl/sbuf.c (revision 32)
+++ trunk/npl/sbuf.c (revision 33)
@@ -1,44 +1,16 @@
11 #include "global.h"
22
3-#define BUFSIZE 256
3+#define DEFAULT_BUFSIZE 256
44
5-struct BufList {
6- struct BufList *next;
7- struct BufList *prev;
8- wchar_t buf[BUFSIZE];
9-};
10-
11-struct npl_sbuf_t {
12- npl_object_t object;
13- struct BufList root;
14- struct BufList *head;
15- struct BufList *tail;
16-};
17-
18-static struct BufList* add_buf_list(npl_sbuf_t *buf)
5+int npl_sbuf_init(npl_sbuf_t *sb)
196 {
20- struct BufList *b;
7+ assert(sb);
218
22- b = malloc(sizeof(struct BufList));
23- if (b == NULL)
24- return NULL; // error
25- memset(b, 0, sizeof(struct BufList));
9+ sb->buf = malloc(DEFAULT_BUFSIZE * sizeof(wchar_t));
10+ if (sb->buf == NULL)
11+ return 1; // error
12+ sb->bufsize = DEFAULT_BUFSIZE;
2613
27- b->prev = buf->tail;
28- buf->tail->next = b;
29- buf->tail = b;
30-
31- return b;
32-}
33-
34-static int _npl_sbuf_init(npl_sbuf_t *sbuf)
35-{
36- assert(sbuf);
37-
38- memset(&sbuf->root, 0, sizeof(struct BufList));
39- sbuf->head = &sbuf->root;
40- sbuf->tail = &sbuf->root;
41-
4214 return 0;
4315 }
4416
@@ -49,7 +21,7 @@
4921 object = npl_object_new(npl_sbuf_type);
5022 if (object == NULL)
5123 return NULL;
52- if (_npl_sbuf_init(NPL_SBUF(object))) {
24+ if (npl_sbuf_init(NPL_SBUF(object))) {
5325 npl_object_unref(object);
5426 return NULL;
5527 }
@@ -59,102 +31,97 @@
5931
6032 int npl_sbuf_add(npl_sbuf_t *sb, const wchar_t *s)
6133 {
62- struct BufList *buf;
63- size_t len, rest;
64- size_t ss, p;
34+ size_t n, size;
35+ int res;
6536
6637 assert(sb);
6738 assert(s);
6839
69- ss = wcslen(s);
70- p = 0;
71- buf = sb->tail;
72- while (ss != p) {
73- len = wcsnlen(buf->buf, BUFSIZE);
74- rest = BUFSIZE - len;
75- if (rest == 0) {
76- buf = add_buf_list(sb);
77- if (buf == NULL)
78- return 1; // error
79- continue;
80- }
81- wmemcpy(&buf->buf[len], &s[p], rest);
82- p += wcsnlen(&s[p], rest);
40+ // バッファの必要サイズを計算し、
41+ // 足りなければ増やす。
42+ size = wcslen(sb->buf);
43+ n = wcslen(s);
44+ size += n;
45+ if (size < n)
46+ return 1; // error
47+ size += 1;
48+ if (size < 1)
49+ return 1; // error
50+ if (sb->bufsize < size) {
51+ res = npl_sbuf_change_bufsize(sb, size);
52+ if (res)
53+ return 1; // error
8354 }
8455
56+ // バッファへ追加
57+ wcscat(sb->buf, s);
58+
8559 return 0;
8660 }
8761
8862 npl_str_t* npl_sbuf_get(npl_sbuf_t *sb)
8963 {
90- struct BufList *buf;
91- size_t len = 0, n;
92- size_t bytes;
93- wchar_t *ws;
94- npl_str_t *str;
64+ assert(sb);
65+ return npl_str_new(sb->buf);;
66+}
9567
68+void npl_sbuf_clear(npl_sbuf_t *sb)
69+{
9670 assert(sb);
71+ wmemset(sb->buf, L'\0', sb->bufsize);
72+}
9773
98- // 文字列の長さを調べる
99- buf = sb->head;
100- while (buf != NULL) {
101- n = wcsnlen(buf->buf, BUFSIZE);
102- len += n;
103- if (len < n)
104- return NULL; // error
105- buf = buf->next;
106- }
74+wchar_t* npl_sbuf_get_buf(npl_sbuf_t *sb)
75+{
76+ assert(sb);
77+ return sb->buf;
78+}
10779
108- // NUL文字の分
109- len++;
110- if (len == 0)
111- return NULL; // error
80+size_t npl_sbuf_get_bufsize(npl_sbuf_t *sb)
81+{
82+ assert(sb);
83+ return sb->bufsize;
84+}
11285
113- // バイト換算
114- if (len > (SIZE_MAX / sizeof(wchar_t)))
115- return NULL; // error
116- bytes = len * sizeof(wchar_t);
86+int npl_sbuf_change_bufsize(npl_sbuf_t *sb, size_t bufsize)
87+{
88+ size_t n, rest;
89+ size_t bytes;
90+ void *res;
11791
118- // メモリ確保
119- ws = malloc(bytes);
120- if (ws == NULL)
121- return NULL; // error
122- wmemset(ws, L'\0', len);
92+ assert(sb);
93+ assert(bufsize >= 1);
12394
124- // 文字をコピー
125- buf = sb->head;
126- while (buf != NULL) {
127- wcsncat(ws, buf->buf, BUFSIZE);
128- buf = buf->next;
129- }
95+ // バッファのバイト数を計算
96+ if (bufsize > (SIZE_MAX / sizeof(wchar_t)))
97+ return 1; // error
98+ bytes = bufsize * sizeof(wchar_t);
13099
131- // npl_str_t* にする
132- str = npl_str_new(ws);
133- free(ws);
100+ // n, rest
101+ n = sb->bufsize;
102+ if (n < bufsize)
103+ rest = bufsize - n;
104+ else
105+ rest = 0;
134106
135- return str;
136-}
107+ // バッファ割り当て
108+ res = realloc(sb->buf, bytes);
109+ if (res == NULL)
110+ return 1; // error
111+ sb->buf = res;
112+ sb->bufsize = bufsize;
137113
138-void npl_sbuf_clear(npl_sbuf_t *sb)
139-{
140- struct BufList *b1, *b2;
114+ // 増えた分のバッファをクリア
115+ if (rest > 0)
116+ wmemset(&sb->buf[n], L'\0', rest);
141117
142- assert(sb);
143-
144- b1 = sb->head->next;
145- while (b1 != NULL) {
146- b2 = b1->next;
147- free(b1);
148- b1 = b2;
149- }
150- _npl_sbuf_init(sb);
118+ return 0;
151119 }
152120
153121 static void _destructor(npl_object_t *object)
154122 {
155123 npl_sbuf_t *sb = NPL_SBUF(object);
156-
157- npl_sbuf_clear(sb);
124+ free(sb->buf);
158125 }
159126
160127 static npl_type_t _npl_sbuf_type = {
--- trunk/npl/str.c (revision 32)
+++ trunk/npl/str.c (revision 33)
@@ -1,57 +1,61 @@
11 #include "global.h"
22
3-int npl_str_init(npl_str_t *str, const wchar_t *s)
3+struct npl_str_t {
4+ npl_object_t object;
5+ wchar_t *str;
6+};
7+
8+npl_str_t* npl_str_new(const wchar_t *s)
49 {
5- assert(str);
6- assert(s);
10+ size_t obj_size;
11+ size_t len, str_size;
12+ npl_str_t *str;
713
8- str->str = wcsdup(s);
9- if (str->str == NULL)
10- return 1; // error
11-
12- return 0;
13-}
14-
15-int npl_str_init_from_mbs(npl_str_t *str, const char *s)
16-{
17- assert(str);
1814 assert(s);
1915
20- str->str = npl_convert_to_wcs(s);
21- if (str->str == NULL)
22- return 1; // error
16+ // 文字列サイズを計算
17+ len = wcslen(s);
18+ len += 1;
19+ if (len < 1)
20+ return NULL;
21+ if (len > (SIZE_MAX / sizeof(wchar_t)))
22+ return NULL;
23+ str_size = len * sizeof(wchar_t);
2324
24- return 0;
25-}
25+ // オブジェクトサイズを計算
26+ obj_size = str_size + sizeof(npl_str_t);
27+ if (obj_size < sizeof(npl_str_t))
28+ return NULL;
2629
27-npl_str_t* npl_str_new(const wchar_t *s)
28-{
29- npl_object_t *object;
30-
31- object = npl_object_new(npl_str_type);
32- if (object == NULL)
30+ // オブジェクト初期化
31+ str = malloc(obj_size);
32+ if (str == NULL)
3333 return NULL;
34- if (npl_str_init(NPL_STR(object), s)) {
35- npl_object_unref(object);
34+ memset(str, 0, obj_size);
35+ if (npl_object_init(&str->object, npl_str_type)) {
36+ free(str);
3637 return NULL;
3738 }
39+ str->str = (void*)(str + 1);
3840
39- return NPL_STR(object);
41+ // 文字列コピー
42+ wcscpy(str->str, s);
43+
44+ return str;
4045 }
4146
4247 npl_str_t* npl_str_new_from_mbs(const char *s)
4348 {
44- npl_object_t *object;
49+ npl_str_t *str;
50+ wchar_t *ws;
4551
46- object = npl_object_new(npl_str_type);
47- if (object == NULL)
52+ ws = npl_convert_to_wcs(s);
53+ if (ws == NULL)
4854 return NULL;
49- if (npl_str_init_from_mbs(NPL_STR(object), s)) {
50- npl_object_unref(object);
51- return NULL;
52- }
5355
54- return NPL_STR(object);
56+ str = npl_str_new(ws);
57+ free(ws);
58+ return str;
5559 }
5660
5761 wchar_t* npl_str_get(npl_str_t *str)
@@ -60,16 +64,6 @@
6064 return str->str;
6165 }
6266
63-static void _destructor(npl_object_t *object)
64-{
65- npl_str_t *s = NPL_STR(object);
66-
67- if (s->str != NULL) {
68- free(s->str);
69- s->str = NULL;
70- }
71-}
72-
7367 npl_type_t _npl_str_type = {
7468 .object = {
7569 .type = &_npl_type_type,
@@ -77,9 +71,9 @@
7771 .static_flag = 1,
7872 },
7973 .name = L"str",
80- .destructor = _destructor,
74+ .destructor = NULL,
8175 .parent = &_npl_object_type,
82- .size = sizeof(npl_str_t),
76+ .size = 0,
8377 };
8478
8579 npl_type_t *npl_str_type = &_npl_str_type;
--- trunk/npl/test/mysbuf.c (revision 32)
+++ trunk/npl/test/mysbuf.c (nonexistent)
@@ -1,64 +0,0 @@
1-/* mysbuf.c
2- *
3- * StringBufferを使い文字列を作る。
4- */
5-
6-#include <stdio.h>
7-#include <stdlib.h>
8-#include "../npl.h"
9-
10-int main()
11-{
12- npl_sbuf_t *sbuf;
13- npl_str_t *str;
14-
15- // NPLライブラリ初期化
16- if (npl_init()) {
17- fprintf(stderr, "npl_init() failed.\n");
18- exit(1);
19- }
20-
21- // sbuf生成
22- sbuf = npl_sbuf_new();
23- if (sbuf == NULL) {
24- fprintf(stderr, "npl_sbuf_new() failed.\n");
25- exit(1);
26- }
27-
28- // sbufに文字を追加する
29- if (npl_sbuf_add(sbuf, L"あいうえお")) {
30- fprintf(stderr, "npl_sbuf_add() failed.\n");
31- exit(1);
32- }
33- if (npl_sbuf_add(sbuf, L"123")) {
34- fprintf(stderr, "npl_sbuf_add() failed.\n");
35- exit(1);
36- }
37- if (npl_sbuf_add(sbuf, L"ABC")) {
38- fprintf(stderr, "npl_sbuf_add() failed.\n");
39- exit(1);
40- }
41-
42- // sbufからstrを得る
43- str = npl_sbuf_get(sbuf);
44- if (str == NULL) {
45- fprintf(stderr, "npl_sbuf_get() failed.\n");
46- exit(1);
47- }
48-
49- // 文字列の内容を表示する
50- printf("\"%S\"\n", npl_str_get(str));
51-
52- // sbuf, str の使用を終える
53- npl_object_unref(NPL_OBJECT(str));
54- npl_object_unref(NPL_OBJECT(sbuf));
55-
56- // NPLライブラリ終了処理
57- if (npl_final()) {
58- fprintf(stderr, "npl_final() failed.\n");
59- exit(1);
60- }
61-
62- return 0;
63-}
64-
--- trunk/npl/test/Makefile (revision 32)
+++ trunk/npl/test/Makefile (revision 33)
@@ -1,4 +1,4 @@
1-all: init hello mysbuf echo
1+all: init hello strbuf echo string
22
33 init: init.c
44 gcc -oinit init.c ../libnpl.a
@@ -6,15 +6,19 @@
66 hello: hello.c
77 gcc -ohello hello.c ../libnpl.a
88
9-mysbuf: mysbuf.c
10- gcc -omysbuf mysbuf.c ../libnpl.a
9+strbuf: strbuf.c
10+ gcc -ostrbuf strbuf.c ../libnpl.a
1111
1212 echo: echo.c
1313 gcc -oecho echo.c ../libnpl.a
1414
15+string: string.c
16+ gcc -ostring string.c ../libnpl.a
17+
1518 clean:
1619 rm -f init
1720 rm -f hello
18- rm -f mysbuf
21+ rm -f strbuf
1922 rm -f echo
23+ rm -f string
2024
--- trunk/npl/test/strbuf.c (nonexistent)
+++ trunk/npl/test/strbuf.c (revision 33)
@@ -0,0 +1,64 @@
1+/* strbuf.c
2+ *
3+ * StringBufferを使い文字列を作る。
4+ */
5+
6+#include <stdio.h>
7+#include <stdlib.h>
8+#include "../npl.h"
9+
10+int main()
11+{
12+ npl_sbuf_t *sbuf;
13+ npl_str_t *str;
14+
15+ // NPLライブラリ初期化
16+ if (npl_init()) {
17+ fprintf(stderr, "npl_init() failed.\n");
18+ exit(1);
19+ }
20+
21+ // sbuf生成
22+ sbuf = npl_sbuf_new();
23+ if (sbuf == NULL) {
24+ fprintf(stderr, "npl_sbuf_new() failed.\n");
25+ exit(1);
26+ }
27+
28+ // sbufに文字を追加する
29+ if (npl_sbuf_add(sbuf, L"あいうえお")) {
30+ fprintf(stderr, "npl_sbuf_add() failed.\n");
31+ exit(1);
32+ }
33+ if (npl_sbuf_add(sbuf, L"123")) {
34+ fprintf(stderr, "npl_sbuf_add() failed.\n");
35+ exit(1);
36+ }
37+ if (npl_sbuf_add(sbuf, L"ABC")) {
38+ fprintf(stderr, "npl_sbuf_add() failed.\n");
39+ exit(1);
40+ }
41+
42+ // sbufからstrを得る
43+ str = npl_sbuf_get(sbuf);
44+ if (str == NULL) {
45+ fprintf(stderr, "npl_sbuf_get() failed.\n");
46+ exit(1);
47+ }
48+
49+ // 文字列の内容を表示する
50+ printf("\"%S\"\n", npl_str_get(str));
51+
52+ // sbuf, str の使用を終える
53+ npl_object_unref(NPL_OBJECT(str));
54+ npl_object_unref(NPL_OBJECT(sbuf));
55+
56+ // NPLライブラリ終了処理
57+ if (npl_final()) {
58+ fprintf(stderr, "npl_final() failed.\n");
59+ exit(1);
60+ }
61+
62+ return 0;
63+}
64+
--- trunk/npl/test/string.c (nonexistent)
+++ trunk/npl/test/string.c (revision 33)
@@ -0,0 +1,48 @@
1+/* string.c
2+ *
3+ */
4+
5+#include <stdio.h>
6+#include <stdlib.h>
7+#include "../npl.h"
8+
9+int main()
10+{
11+ npl_str_t *s1, *s2;
12+ npl_mbstr_t *m1, *m2;
13+
14+ // NPLライブラリ初期化
15+ if (npl_init()) {
16+ fprintf(stderr, "npl_init() failed.\n");
17+ exit(1);
18+ }
19+
20+ s1 = npl_str_new(L"あいうえお");
21+ s2 = npl_str_new_from_mbs("かきくけこ");
22+ m1 = npl_mbstr_new("さしすせそ");
23+ m2 = npl_mbstr_new_from_wcs(L"たちつてと");
24+
25+ if (s1 && s2 && m1 && m2) {
26+ printf("%S\n", npl_str_get(s1));
27+ printf("%S\n", npl_str_get(s2));
28+ printf("%s\n", npl_mbstr_get(m1));
29+ printf("%s\n", npl_mbstr_get(m2));
30+ } else {
31+ fprintf(stderr, "error!\n");
32+ exit(1);
33+ }
34+
35+ npl_object_unref(NPL_OBJECT(s1));
36+ npl_object_unref(NPL_OBJECT(s2));
37+ npl_object_unref(NPL_OBJECT(m1));
38+ npl_object_unref(NPL_OBJECT(m2));
39+
40+ // NPLライブラリ終了処理
41+ if (npl_final()) {
42+ fprintf(stderr, "npl_final() failed.\n");
43+ exit(1);
44+ }
45+
46+ return 0;
47+}
48+
旧リポジトリブラウザで表示