Initial revision
authorceriel <none@none>
Mon, 5 Jan 1987 14:56:11 +0000 (14:56 +0000)
committerceriel <none@none>
Mon, 5 Jan 1987 14:56:11 +0000 (14:56 +0000)
modules/src/assert/assert.3 [new file with mode: 0644]
modules/src/assert/assert.h [new file with mode: 0644]

diff --git a/modules/src/assert/assert.3 b/modules/src/assert/assert.3
new file mode 100644 (file)
index 0000000..e5cdd60
--- /dev/null
@@ -0,0 +1,60 @@
+.TH assert 3ACK "march 25, 1986"
+.SH NAME
+assert \- program verification
+.SH SYNOPSIS
+.B #include <assert.h>
+.PP
+.B assert(expression)
+.PP
+.B _BadAssertion(fn, lino, ass)
+.br
+char *fn, *ass;
+.br
+unsigned int lino;
+.SH DESCRIPTION
+.PP
+.I Assert
+is a macro that indicates
+.I expression
+is expected to be true at this point in the program.
+It causes a call to 
+.I _BadAssertion
+when 
+.I expression
+is false (0).
+.PP
+The routine
+.I_BadAssertion
+accepts three parameters:
+a filename, a linenumber,
+and a string representing a failed assertion.
+It causes a
+.IR sys_stop (S_ABORT)
+with a diagnostic comment on standard error.
+.PP
+The assertions are enabled by defining the preprocessor constant DEBUG.
+.SH DIAGNOSTICS
+.IR fn ,
+line
+.IR lino :
+assertion
+.I ass
+failed.
+.br
+.I fn
+is the source file,
+.I lino
+is the source line number,
+and
+.I ass
+is the assertion
+of the
+.I assert
+statement.
+.SH MODULES
+system(3)
+.SH FILES
+.nf
+~em/modules/h/assert.h
+~em/modules/lib/libassert.a
+.fi
diff --git a/modules/src/assert/assert.h b/modules/src/assert/assert.h
new file mode 100644 (file)
index 0000000..ca82581
--- /dev/null
@@ -0,0 +1,9 @@
+/* $Header$ */
+/*      A S S E R T I O N    M A C R O   D E F I N I T I O N           */
+
+#ifdef DEBUG
+/*     Note: this macro uses parameter substitution inside strings */
+#define        assert(exp)     (exp || _BadAssertion(__FILE__, __LINE__, "exp"))
+#else
+#define        assert(exp)     (1)
+#endif DEBUG