• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン9d439224ff7277f7073c89288052869b96532481 (tree)
日時2020-02-09 22:54:51
作者dhrname <dhrname@user...>
コミッターdhrname

ログメッセージ

Add the Exception.c as a module

変更サマリ

差分

--- /dev/null
+++ b/source_code/CLANGMakefile
@@ -0,0 +1,24 @@
1+CC = clang
2+DEBUGMODE = -Wall -std=c11 -O0 -g -pg
3+NODEBUGMODE = -Wall -std=c11 -O2
4+SHELL = /bin/sh
5+HEADERS = shadowstar.h star.h orderedpair/exception.h orderedpair/pair.h orderedpair/list/item.h orderedpair/list/tree/btree.h orderedpair/list/tree/nodelist/ntree.h
6+
7+all : startest star
8+.PHONY : all
9+
10+%.o : %.c
11+ $(CC) $(NODEBUGMODE) -c $< -o $@
12+
13+star.o: $(HEADERS)
14+
15+shadowstar.o: $(HEADERS)
16+
17+star: shadowstar.o star.o
18+ $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o star.o
19+
20+startest: shadowstar.o startest.o
21+ $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o startest.o
22+
23+clean:
24+ rm -f shadowstar.o startest.o star.o
--- a/source_code/Makefile
+++ b/source_code/Makefile
@@ -2,7 +2,7 @@ CC = gcc
22 DEBUGMODE = -Wall -std=c11 -O0 -g -pg
33 NODEBUGMODE = -Wall -std=c11 -O2
44 SHELL = /bin/sh
5-HEADERS = shadowstar.h star.h orderedpair/exception.h orderedpair/pair.h orderedpair/list/item.h orderedpair/list/tree/btree.h orderedpair/list/tree/nodelist/ntree.h orderedpair/list/tree/nodelist/class/class.h
5+HEADERS = shadowstar.h star.h orderedpair/pair.h orderedpair/list/item.h orderedpair/list/tree/btree.h orderedpair/list/tree/nodelist/ntree.h orderedpair/list/tree/nodelist/class/class.h
66
77 all : startest star
88 .PHONY : all
@@ -10,15 +10,17 @@ all : startest star
1010 %.o : %.c
1111 $(CC) $(NODEBUGMODE) -c $< -o $@
1212
13+exception.o: orderedpair/exception.h
14+
1315 star.o: $(HEADERS)
1416
1517 shadowstar.o: $(HEADERS)
1618
17-star: shadowstar.o star.o
18- $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o star.o
19+star: shadowstar.o star.o exception.o
20+ $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o star.o exception.o
1921
20-startest: shadowstar.o startest.o
21- $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o startest.o
22+startest: shadowstar.o startest.o exception.o
23+ $(CC) $(NODEBUGMODE) -o ../$@ shadowstar.o startest.o exception.o
2224
2325 clean:
24- rm -f shadowstar.o startest.o star.o
26+ rm -f shadowstar.o startest.o star.o exception.o
--- /dev/null
+++ b/source_code/exception.c
@@ -0,0 +1,63 @@
1+/*
2+ * exception.c
3+ *
4+ * Copyright (C) 2017 dhrname <dhrnamesie@joestar.sakura.ne.jp>
5+ *
6+ *
7+ */
8+#include "shadowstar.h"
9+
10+/*Init_errno_before_eprint 文字列
11+ * 以下のerrno_before_eprintを初期化させたいときに使う数値*/
12+Errno_code_eprint Init_errno_before_eprint = UNKNOWN_ERROR;
13+
14+/*errno_before_eprint 文字列
15+ * エラーを呼び出される前に、この数値で指定された文字列を標準出力する
16+ * eprint関数やeprint_log関数が呼び出されたとき、その前に出力される
17+ * エラーの呼び出し元を追跡したいときに使う*/
18+Errno_code_eprint errno_before_eprint = UNKNOWN_ERROR;
19+
20+/*エラーコードに対応したメッセージ集
21+ * どこで、エラーが起きたかを文章として残して、追跡しやすくするためのもの*/
22+ST_Char *const message_berfore_eprint[] = {
23+ u8"Unknown Error",
24+ u8"ST_createNode Error",
25+ u8"ST_insertBefore Error",
26+ u8"ST_getNodeValue Error",
27+ u8"ST_getLastChild Error",
28+ u8"ST_getPreviousNode Error",
29+ u8"ST_copyNode Error",
30+ u8"ST_getParentNode Error",
31+ u8"ST_removeChild Error",
32+ u8"ST_readFile Error",
33+};
34+
35+/*eprintf 関数
36+ * プログラムを中止させるためのエラー処理を担当。入力値はエラーを報告する文章
37+ * 参照:「プログラミング作法」(Brian W.kernighan, Rob Pike) p.156, ISBN4-7561-3649-4*/
38+void eprintf (ST_Char *fmt, ...)
39+{
40+ printf("%s>\n", message_berfore_eprint[errno_before_eprint]);
41+ va_list args;
42+ fflush(stdout);
43+ va_start(args, fmt);
44+ vfprintf(stderr, fmt, args);
45+ va_end(args);
46+ perror("");
47+ fprintf(stderr, "\n");
48+ exit(EXIT_FAILURE);
49+}
50+
51+/*eprint_log 関数
52+ * エラー処理をした後で、ログに記録する。プログラムは中止しない。
53+ * 入力値はエラーを報告する文章
54+ * */
55+void eprint_log (ST_Char *fmt)
56+{
57+ printf("%s>\n", message_berfore_eprint[errno_before_eprint]);
58+ errno_before_eprint = Init_errno_before_eprint;
59+ fflush(stdout);
60+ perror(fmt);
61+ fprintf(stderr, "\n");
62+}
63+
Binary files /dev/null and b/source_code/exception.o differ
--- /dev/null
+++ b/source_code/ff
@@ -0,0 +1 @@
1+愛とは、 「 「謎」(謎)は「謎」(謎) 」 (謎)
\ No newline at end of file
Binary files a/source_code/orderedpair/exception.h.gch and /dev/null differ
--- /dev/null
+++ b/source_code/orderedpair/list/tree/nodelist/class/geany_run_script.bat
@@ -0,0 +1,6 @@
1+"./../startest"
2+
3+pause
4+del "%0"
5+
6+pause
--- a/source_code/shadowstar.c
+++ b/source_code/shadowstar.c
@@ -1,67 +1,13 @@
11 /*
22 * shadowstar.c
33 *
4- * Copyright (C) 2017 dhrname <dhrnamesie@yahoo.co.jp>
4+ * Copyright (C) 2017 dhrname <dhrnamesie@joestar.sakura.ne.jp>
55 *
66 *
77 */
88
99 #include "shadowstar.h"
1010
11-/*Init_errno_before_eprint 文字列
12- * 以下のerrno_before_eprintを初期化させたいときに使う数値*/
13-Errno_code_eprint Init_errno_before_eprint = UNKNOWN_ERROR;
14-
15-/*errno_before_eprint 文字列
16- * エラーを呼び出される前に、この数値で指定された文字列を標準出力する
17- * eprint関数やeprint_log関数が呼び出されたとき、その前に出力される
18- * エラーの呼び出し元を追跡したいときに使う*/
19-Errno_code_eprint errno_before_eprint = UNKNOWN_ERROR;
20-
21-/*エラーコードに対応したメッセージ集
22- * どこで、エラーが起きたかを文章として残して、追跡しやすくするためのもの*/
23-ST_Char *const message_berfore_eprint[] = {
24- u8"Unknown Error",
25- u8"ST_createNode Error",
26- u8"ST_insertBefore Error",
27- u8"ST_getNodeValue Error",
28- u8"ST_getLastChild Error",
29- u8"ST_getPreviousNode Error",
30- u8"ST_copyNode Error",
31- u8"ST_getParentNode Error",
32- u8"ST_removeChild Error",
33- u8"ST_readFile Error",
34-};
35-
36-/*eprintf 関数
37- * プログラムを中止させるためのエラー処理を担当。入力値はエラーを報告する文章
38- * 参照:「プログラミング作法」(Brian W.kernighan, Rob Pike) p.156, ISBN4-7561-3649-4*/
39-void eprintf (ST_Char *fmt, ...)
40-{
41- printf("%s>\n", message_berfore_eprint[errno_before_eprint]);
42- va_list args;
43- fflush(stdout);
44- va_start(args, fmt);
45- vfprintf(stderr, fmt, args);
46- va_end(args);
47- perror("");
48- fprintf(stderr, "\n");
49- exit(EXIT_FAILURE);
50-}
51-
52-/*eprint_log 関数
53- * エラー処理をした後で、ログに記録する。プログラムは中止しない。
54- * 入力値はエラーを報告する文章
55- * */
56-void eprint_log (ST_Char *fmt)
57-{
58- printf("%s>\n", message_berfore_eprint[errno_before_eprint]);
59- errno_before_eprint = Init_errno_before_eprint;
60- fflush(stdout);
61- perror(fmt);
62- fprintf(stderr, "\n");
63-}
64-
6511
6612 /*text2token関数
6713 * textの一部とtargetの文字列が一致したら、トークンをtokenNumberに設定
--- a/source_code/shadowstar.h
+++ b/source_code/shadowstar.h
@@ -1,7 +1,7 @@
11 /*
22 * Star - A Programing language.
33 *
4- * Copyright (C) 2017 dhrname <dhrnamesie@yahoo.co.jp>
4+ * Copyright (C) 2017 dhrname <dhrnamesie@joestar.sakura.ne.jp>
55 */
66
77 #pragma once
Binary files a/source_code/shadowstar.o and b/source_code/shadowstar.o differ
Binary files /dev/null and b/source_code/star.h.gch differ