Index: EcnlProtoTool/trunk/asp3_dcre/include/t_syslog.h
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/include/t_syslog.h	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/include/t_syslog.h	(revision 429)
@@ -1,10 +1,9 @@
 /*
- *  TOPPERS/ASP Kernel
- *      Toyohashi Open Platform for Embedded Real-Time Systems/
- *      Advanced Standard Profile Kernel
+ *  TOPPERS Software
+ *      Toyohashi Open Platform for Embedded Real-Time Systems
  * 
  *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
  *                              Toyohashi Univ. of Technology, JAPAN
- *  Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
+ *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
  *              Graduate School of Information Science, Nagoya Univ., JAPAN
  * 
@@ -69,4 +68,8 @@
 #include <t_stddef.h>
 
+#ifndef TOPPERS_MACRO_ONLY
+#include <stdarg.h>
+#endif /* TOPPERS_MACRO_ONLY */
+
 /*
  *  ログ情報の種別の定義
@@ -77,6 +80,6 @@
 #define LOG_TYPE_INH		UINT_C(0x11)	/* 割込みハンドラ */
 #define LOG_TYPE_ISR		UINT_C(0x12)	/* 割込みサービスルーチン */
-#define LOG_TYPE_CYC		UINT_C(0x13)	/* 周期ハンドラ */
-#define LOG_TYPE_ALM		UINT_C(0x14)	/* アラームハンドラ */
+#define LOG_TYPE_CYC		UINT_C(0x13)	/* 周期通知 */
+#define LOG_TYPE_ALM		UINT_C(0x14)	/* アラーム通知 */
 #define LOG_TYPE_OVR		UINT_C(0x15)	/* オーバランハンドラ */
 #define LOG_TYPE_EXC		UINT_C(0x16)	/* CPU例外ハンドラ */
@@ -124,61 +127,51 @@
 
 /*
- *  ログ情報の重要度のビットマップを作るためのマクロ
- */
-#define LOG_MASK(prio)		(1U << (prio))
-#define LOG_UPTO(prio)		((1U << ((prio) + 1)) - 1)
-
-/*
- *  パケット形式の定義
- */
-typedef struct t_syslog_rlog {
-	uint_t	count;		/* ログバッファ中のログの数 */
-	uint_t	lost;		/* 失われたログの数 */
-	uint_t	logmask;	/* ログバッファに記録すべき重要度 */
-	uint_t	lowmask;	/* 低レベル出力すべき重要度 */
-} T_SYSLOG_RLOG;
+ *  ログ情報の出力
+ *
+ *  ログ情報の出力は，システムログ機能のアダプタ経由で行う．
+ */
+
+extern ER	syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) throw();
+
+#define syslog_write(prio, p_syslog) \
+						((void) syslog_wri_log(prio, p_syslog))
 
 #ifndef TOPPERS_OMIT_SYSLOG
-
-/*
- *  ログ情報を出力するためのライブラリ関数
- *
- *  TECSで記述されたシステムログ機能を直接呼び出す．
- */
-
-extern ER	tSysLog_eSysLog_write(uint_t prio, const SYSLOG *p_syslog) throw();
-
-Inline void
-_syslog_0(uint_t prio, uint_t type)
-{
-	SYSLOG	logbuf;
-
-	logbuf.logtype = type;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
-{
-	SYSLOG	logbuf;
-
-	logbuf.logtype = type;
-	logbuf.logpar[0] = arg1;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
-{
-	SYSLOG	logbuf;
-
-	logbuf.logtype = type;
-	logbuf.logpar[0] = arg1;
-	logbuf.logpar[1] = arg2;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
+/*
+ *  システムログ出力のための下位のライブラリ関数
+ */
+
+Inline void
+t_syslog_0(uint_t prio, uint_t type)
+{
+	SYSLOG	logbuf;
+
+	logbuf.logtype = type;
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
+{
+	SYSLOG	logbuf;
+
+	logbuf.logtype = type;
+	logbuf.logpar[0] = arg1;
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
+{
+	SYSLOG	logbuf;
+
+	logbuf.logtype = type;
+	logbuf.logpar[0] = arg1;
+	logbuf.logpar[1] = arg2;
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
 {
 	SYSLOG	logbuf;
@@ -188,9 +181,9 @@
 	logbuf.logpar[1] = arg2;
 	logbuf.logpar[2] = arg3;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 											LOGPAR arg3, LOGPAR arg4)
 {
@@ -202,9 +195,9 @@
 	logbuf.logpar[2] = arg3;
 	logbuf.logpar[3] = arg4;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 								LOGPAR arg3, LOGPAR arg4, LOGPAR arg5)
 {
@@ -217,9 +210,9 @@
 	logbuf.logpar[3] = arg4;
 	logbuf.logpar[4] = arg5;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
-}
-
-Inline void
-_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+	syslog_write(prio, &logbuf);
+}
+
+Inline void
+t_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 					LOGPAR arg3, LOGPAR arg4, LOGPAR arg5, LOGPAR arg6)
 {
@@ -233,5 +226,5 @@
 	logbuf.logpar[4] = arg5;
 	logbuf.logpar[5] = arg6;
-	(void) tSysLog_eSysLog_write(prio, &logbuf);
+	syslog_write(prio, &logbuf);
 }
 
@@ -239,8 +232,34 @@
  *  ログ情報（コメント）を出力するためのライブラリ関数（vasyslog.c）
  */
-extern void	syslog(uint_t prio, const char *format, ...) throw();
+extern void	tt_syslog(SYSLOG *p_logbuf, const char *format, va_list ap);
+
+Inline void
+syslog(uint_t prio, const char *format, ...)
+{
+	va_list	ap;
+	SYSLOG	logbuf;
+
+	va_start(ap, format);
+	tt_syslog(&logbuf, format, ap);
+	va_end(ap);
+	syslog_write(prio, &logbuf);
+}
+
+/*
+ *  エラーメッセージを出力するためのライブラリ関数（t_perror.c）
+ */
+extern void	tt_perror(SYSLOG *p_logbuf, const char *file, int_t line,
+		 									const char *expr, ER ercd);
+
+Inline void
+t_perror(uint_t prio, const char *file, int_t line, const char *expr, ER ercd)
+{
+	SYSLOG	logbuf;
+
+	tt_perror(&logbuf, file, line, expr, ercd);
+	syslog_write(prio, &logbuf);
+}
 
 #else /* TOPPERS_OMIT_SYSLOG */
-
 /*
  *  システムログ出力を抑止する場合
@@ -248,25 +267,25 @@
 
 Inline void
-_syslog_0(uint_t prio, uint_t type)
-{
-}
-
-Inline void
-_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
-{
-}
-
-Inline void
-_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
-{
-}
-
-Inline void
-_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
-{
-}
-
-Inline void
-_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+t_syslog_0(uint_t prio, uint_t type)
+{
+}
+
+Inline void
+t_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
+{
+}
+
+Inline void
+t_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
+{
+}
+
+Inline void
+t_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
+{
+}
+
+Inline void
+t_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 											LOGPAR arg3, LOGPAR arg4)
 {
@@ -274,5 +293,5 @@
 
 Inline void
-_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+t_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 								LOGPAR arg3, LOGPAR arg4, LOGPAR arg5)
 {
@@ -280,5 +299,5 @@
 
 Inline void
-_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
+t_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
 					LOGPAR arg3, LOGPAR arg4, LOGPAR arg5, LOGPAR arg6)
 {
@@ -289,9 +308,14 @@
 {
 }
+												
+Inline void
+t_perror(uint_t prio, const char *file, int_t line, const char *expr, ER ercd)
+{
+}
 
 #endif /* TOPPERS_OMIT_SYSLOG */
 
 /*
- *  ログ情報（コメント）を出力するためのマクロ
+ *  システムログ出力のためのライブラリ関数
  *
  *  formatおよび後続の引数から作成したメッセージを，重大度prioでログ情
@@ -301,25 +325,25 @@
 
 #define syslog_0(prio, format) \
-				_syslog_1(prio, LOG_TYPE_COMMENT, (LOGPAR)(format))
+				t_syslog_1(prio, LOG_TYPE_COMMENT, (LOGPAR)(format))
 
 #define syslog_1(prio, format, arg1) \
-				_syslog_2(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
+				t_syslog_2(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
 														(LOGPAR)(arg1))
 
 #define syslog_2(prio, format, arg1, arg2) \
-				_syslog_3(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
+				t_syslog_3(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
 										(LOGPAR)(arg1), (LOGPAR)(arg2))
 
 #define syslog_3(prio, format, arg1, arg2, arg3) \
-				_syslog_4(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
+				t_syslog_4(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
 						(LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3))
 
 #define syslog_4(prio, format, arg1, arg2, arg3, arg4) \
-				_syslog_5(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
+				t_syslog_5(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
 						(LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3), \
 														(LOGPAR)(arg4))
 
 #define syslog_5(prio, format, arg1, arg2, arg3, arg4, arg5) \
-				_syslog_6(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
+				t_syslog_6(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
 						(LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3), \
 										(LOGPAR)(arg4), (LOGPAR)(arg5))
@@ -330,5 +354,5 @@
 #ifndef TOPPERS_assert_fail
 #define TOPPERS_assert_fail(exp, file, line) \
-				_syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (LOGPAR)(file), \
+				t_syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (LOGPAR)(file), \
 										(LOGPAR)(line), (LOGPAR)(exp))
 #endif /* TOPPERS_assert_fail */
