CScpp/Debug.h
changeset 0 5c129dd80d4f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CScpp/Debug.h	Thu Nov 21 14:55:10 2019 +0100
@@ -0,0 +1,25 @@
+#ifndef _DebugH_
+#define _DebugH_ 1
+
+class DebugC {		// independent utility staff
+	public:
+		static int debug;					// debug log level
+		static char *prg_name;			// not used at the moment
+		static long int t0;
+		static sem_t semaphore;			// semafor for log timestamping
+		static sem_t *semP;				// -->semafor for log timestamping
+		static void debug_init(char *prgname);
+
+		char s[256];						// debug msg workspace
+		char debid[128];					// debug ID of process
+
+		void pre(char *o);
+		void deb(int level);
+		void err(int level, char *o);
+		void back_trace();
+};
+typedef DebugC *DebugP;
+
+#define DEBID(...) sprintf(deP->debid, __VA_ARGS__)
+#define LOG(level, ...) sprintf(deP->s, __VA_ARGS__), deP->deb(level)
+#endif