Altmost compilable, weak symbol definitions still missing.
[vblib.git] / vblib.h
diff --git a/vblib.h b/vblib.h
index 8ee18bc..0b3e93c 100644 (file)
--- a/vblib.h
+++ b/vblib.h
  * Configuration section follows
  */
 
+/*
+ * PSTR_16BIT: whether PSTR strings should be preceded
+ *   by 16-bit or 8-bit length (thus also limiting the maximum
+ *   allowed length of PSTR string)
+ */
 //#define PSTR_16BIT
+
+/*
+ * INLINE_PUTGETCHAR: inline vb{put,get}char()
+ */
 #define INLINE_PUTGETCHAR
+
+/*
+ * FATALSIG_INSANE: if defined, no vbcheck()s are done after some fatal
+ *   signal has been caught as the data structures may be corrupted
+ *   already thereafter
+ */
 //#define FATALSIG_INSANE
 
+/*
+ * HAVE_PTHREAD: vbcheck() serialization between threds
+ *   Please note that VB library in general is NOT multithreading safe.
+ */
+//#define HAVE_PTHREAD
+
+/*
+ * VB_DEFSIZE: Default size of buffer of "vb" object. Large sizes may
+ *   slow down vbcopy() significantly.
+ */
 #define VB_DEFSIZE 256 //>=min of n in vsnprintf()
+
+/*
+ * LOGF_FGETS_BUF: Buffer size for vbgetlinef(), doesn't hard limit anything,
+ *   it has only performance impact.
+ */
+#define LOGF_FGETS_BUF VB_DEFSIZE
+
+/*
+ * VB_MAXSIZE: Maximum size of one "vbn" segment to prevent circular
+ *   use of "vb" to eat up the whole memory. It doesn't limit the maximum
+ *   data storage of "vb" object in no way, it has only performance impact.
+ */
 #define VB_MAXSIZE 128*1024 //recommended limit, not hard (probably)
 
+/*
+ * CHAT_CMD_MAXPARS: Size of chat_cmdpars[] array, maximum # of parameters
+ *   a user command can have during chat_proccmd() parse.
+ */
 #define CHAT_CMD_MAXPARS 10
 
 /*
  * Configuration section ends
  ****************************/
 
+#ifndef VB_LOG
+#define VB_LOG(lev,msg...) fprintf(stderr,VB_LOG_##lev ##msg)
+#endif
+#ifndef VB_FATAL
+#define VB_FATAL(lev,msg...) do { VB_LOG(lev, ##msg); exit(EXIT_FAILURE); } while (0)
+#endif
+
+#define VB_LOG_DEBUG "VB_Debug: "
+#define VB_LOG_ERR   "VB_Error: "
+#define VB_LOG_CRIT  "VB_Critical: "
+
 #define strncpydst(d,s) strncpy(d,s,sizeof(d))
 #ifdef NDEBUG
 #undef DEBUG