summaryrefslogtreecommitdiff
path: root/contrib/isn/isn.h
diff options
context:
space:
mode:
authorTom Lane2006-09-09 04:07:52 +0000
committerTom Lane2006-09-09 04:07:52 +0000
commitdff84dc762bd225dbf69f5baa639560310053a74 (patch)
treeb38d627b5c18a99cd62b85e4d45a4b021177ba50 /contrib/isn/isn.h
parent42c17a6bb07f7400a14dffce687f14cc748fa064 (diff)
Add contrib/isn module for ISBN/ISSN/EAN13/etc product numbers, and
remove the old isbn_issn module which is about to be obsoleted by EAN13. contrib/isn is by Germán Méndez Bravo. Our thanks to Garrett A. Wollman for having written the original isbn_issn module.
Diffstat (limited to 'contrib/isn/isn.h')
-rw-r--r--contrib/isn/isn.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/contrib/isn/isn.h b/contrib/isn/isn.h
new file mode 100644
index 00000000000..d4369830d95
--- /dev/null
+++ b/contrib/isn/isn.h
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ *
+ * isn.h
+ * PostgreSQL type definitions for ISNs (ISBN, ISMN, ISSN, EAN13, UPC)
+ *
+ * Copyright (c) 2004-2006, Germán Méndez Bravo (Kronuz)
+ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * $PostgreSQL: pgsql/contrib/isn/isn.h,v 1.1 2006/09/09 04:07:52 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef ISN_H
+#define ISN_H
+
+#include "fmgr.h"
+
+#undef ISN_DEBUG
+#define ISN_WEAK_MODE
+
+/*
+ * uint64 is the internal storage format for ISNs.
+ */
+typedef uint64 ean13;
+
+#define EAN13_FORMAT UINT64_FORMAT
+
+#define PG_GETARG_EAN13(n) PG_GETARG_INT64(n)
+#define PG_RETURN_EAN13(x) PG_RETURN_INT64(x)
+
+extern Datum isn_out(PG_FUNCTION_ARGS);
+extern Datum ean13_out(PG_FUNCTION_ARGS);
+extern Datum ean13_in(PG_FUNCTION_ARGS);
+extern Datum isbn_in(PG_FUNCTION_ARGS);
+extern Datum ismn_in(PG_FUNCTION_ARGS);
+extern Datum issn_in(PG_FUNCTION_ARGS);
+extern Datum upc_in(PG_FUNCTION_ARGS);
+
+extern Datum ean13_cast_to_text(PG_FUNCTION_ARGS);
+extern Datum isn_cast_to_text(PG_FUNCTION_ARGS);
+extern Datum ean13_cast_from_text(PG_FUNCTION_ARGS);
+extern Datum isbn_cast_from_text(PG_FUNCTION_ARGS);
+extern Datum ismn_cast_from_text(PG_FUNCTION_ARGS);
+extern Datum issn_cast_from_text(PG_FUNCTION_ARGS);
+extern Datum upc_cast_from_text(PG_FUNCTION_ARGS);
+
+extern Datum is_valid(PG_FUNCTION_ARGS);
+extern Datum make_valid(PG_FUNCTION_ARGS);
+
+extern Datum accept_weak_input(PG_FUNCTION_ARGS);
+extern Datum weak_input_status(PG_FUNCTION_ARGS);
+
+extern void initialize(void);
+
+#endif /* ISN_H */