summaryrefslogtreecommitdiffstats
path: root/pbn_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbn_dump.c')
-rw-r--r--pbn_dump.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/pbn_dump.c b/pbn_dump.c
new file mode 100644
index 0000000..5dbcde1
--- /dev/null
+++ b/pbn_dump.c
@@ -0,0 +1,35 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007 H. Peter Anvin - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, Inc.,
+ * 59 Temple Place Ste 330, Boston MA 02111-1307, USA; version 2.1,
+ * incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * pbn_dump.c
+ *
+ * Output an PBN in hexadecimal form, mainly intended for debugging
+ */
+
+#include <stdio.h>
+#include "pbnint.h"
+
+void pbn_dump(FILE *f, struct pbn *pbn)
+{
+ int i;
+
+ putc(pbn->minus ? '-' : '+', f);
+
+ for (i = pbn->len-1; i >= 0; i--) {
+ fprintf(f, "%" PBN_ATOM_xFMT, pbn->num[i]);
+ if (i)
+ putc('_', f);
+ }
+
+ pbn_free(pbn);
+}