#include "fmgr.h"
Go to the source code of this file.
Defines | |
#define | ISN_WEAK_MODE |
#define | EAN13_FORMAT UINT64_FORMAT |
#define | PG_GETARG_EAN13(n) PG_GETARG_INT64(n) |
#define | PG_RETURN_EAN13(x) PG_RETURN_INT64(x) |
Typedefs | |
typedef uint64 | ean13 |
Functions | |
Datum | isn_out (PG_FUNCTION_ARGS) |
Datum | ean13_out (PG_FUNCTION_ARGS) |
Datum | ean13_in (PG_FUNCTION_ARGS) |
Datum | isbn_in (PG_FUNCTION_ARGS) |
Datum | ismn_in (PG_FUNCTION_ARGS) |
Datum | issn_in (PG_FUNCTION_ARGS) |
Datum | upc_in (PG_FUNCTION_ARGS) |
Datum | isbn_cast_from_ean13 (PG_FUNCTION_ARGS) |
Datum | ismn_cast_from_ean13 (PG_FUNCTION_ARGS) |
Datum | issn_cast_from_ean13 (PG_FUNCTION_ARGS) |
Datum | upc_cast_from_ean13 (PG_FUNCTION_ARGS) |
Datum | is_valid (PG_FUNCTION_ARGS) |
Datum | make_valid (PG_FUNCTION_ARGS) |
Datum | accept_weak_input (PG_FUNCTION_ARGS) |
Datum | weak_input_status (PG_FUNCTION_ARGS) |
void | initialize (void) |
#define EAN13_FORMAT UINT64_FORMAT |
Definition at line 28 of file isn.h.
Referenced by ean2isn(), and ean2string().
#define PG_GETARG_EAN13 | ( | n | ) | PG_GETARG_INT64(n) |
Definition at line 30 of file isn.h.
Referenced by ean13_out(), is_valid(), isbn_cast_from_ean13(), ismn_cast_from_ean13(), isn_out(), issn_cast_from_ean13(), make_valid(), and upc_cast_from_ean13().
#define PG_RETURN_EAN13 | ( | x | ) | PG_RETURN_INT64(x) |
Definition at line 31 of file isn.h.
Referenced by ean13_in(), isbn_cast_from_ean13(), isbn_in(), ismn_cast_from_ean13(), ismn_in(), issn_cast_from_ean13(), issn_in(), make_valid(), upc_cast_from_ean13(), and upc_in().
Datum accept_weak_input | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1113 of file isn.c.
References g_weak, PG_GETARG_BOOL, and PG_RETURN_BOOL.
{ #ifdef ISN_WEAK_MODE g_weak = PG_GETARG_BOOL(0); #else /* function has no effect */ #endif /* ISN_WEAK_MODE */ PG_RETURN_BOOL(g_weak); }
Datum ean13_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 972 of file isn.c.
References EAN13, PG_GETARG_CSTRING, PG_RETURN_EAN13, and string2ean().
{ const char *str = PG_GETARG_CSTRING(0); ean13 result; (void) string2ean(str, false, &result, EAN13); PG_RETURN_EAN13(result); }
Datum ean13_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 956 of file isn.c.
References buf, ean2string(), MAXEAN13LEN, PG_GETARG_EAN13, PG_RETURN_CSTRING, pstrdup(), and val.
{ ean13 val = PG_GETARG_EAN13(0); char *result; char buf[MAXEAN13LEN + 1]; (void) ean2string(val, false, buf, false); result = pstrdup(buf); PG_RETURN_CSTRING(result); }
void initialize | ( | void | ) |
Definition at line 919 of file isn.c.
References EAN13, EAN13_index, elog, g_initialized, ISBN, ISBN_index, ISMN, ISMN_index, ISSN, ISSN_index, LOG, UPC, and UPC_index.
Referenced by longest(), and shortest().
{ #ifdef ISN_DEBUG if (!check_table(EAN13, EAN13_index)) elog(LOG, "EAN13 failed check"); if (!check_table(ISBN, ISBN_index)) elog(LOG, "ISBN failed check"); if (!check_table(ISMN, ISMN_index)) elog(LOG, "ISMN failed check"); if (!check_table(ISSN, ISSN_index)) elog(LOG, "ISSN failed check"); if (!check_table(UPC, UPC_index)) elog(LOG, "UPC failed check"); #endif g_initialized = true; }
Datum is_valid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1088 of file isn.c.
References PG_GETARG_EAN13, PG_RETURN_BOOL, and val.
{ ean13 val = PG_GETARG_EAN13(0); PG_RETURN_BOOL((val & 1) == 0); }
Datum isbn_cast_from_ean13 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1037 of file isn.c.
References ean2isn(), ISBN, PG_GETARG_EAN13, PG_RETURN_EAN13, and val.
{ ean13 val = PG_GETARG_EAN13(0); ean13 result; (void) ean2isn(val, false, &result, ISBN); PG_RETURN_EAN13(result); }
Datum isbn_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 985 of file isn.c.
References ISBN, PG_GETARG_CSTRING, PG_RETURN_EAN13, and string2ean().
{ const char *str = PG_GETARG_CSTRING(0); ean13 result; (void) string2ean(str, false, &result, ISBN); PG_RETURN_EAN13(result); }
Datum ismn_cast_from_ean13 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1049 of file isn.c.
References ean2isn(), ISMN, PG_GETARG_EAN13, PG_RETURN_EAN13, and val.
{ ean13 val = PG_GETARG_EAN13(0); ean13 result; (void) ean2isn(val, false, &result, ISMN); PG_RETURN_EAN13(result); }
Datum ismn_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 998 of file isn.c.
References ISMN, PG_GETARG_CSTRING, PG_RETURN_EAN13, and string2ean().
{ const char *str = PG_GETARG_CSTRING(0); ean13 result; (void) string2ean(str, false, &result, ISMN); PG_RETURN_EAN13(result); }
Datum isn_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 940 of file isn.c.
References buf, ean2string(), MAXEAN13LEN, PG_GETARG_EAN13, PG_RETURN_CSTRING, pstrdup(), and val.
{ ean13 val = PG_GETARG_EAN13(0); char *result; char buf[MAXEAN13LEN + 1]; (void) ean2string(val, false, buf, true); result = pstrdup(buf); PG_RETURN_CSTRING(result); }
Datum issn_cast_from_ean13 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1061 of file isn.c.
References ean2isn(), ISSN, PG_GETARG_EAN13, PG_RETURN_EAN13, and val.
{ ean13 val = PG_GETARG_EAN13(0); ean13 result; (void) ean2isn(val, false, &result, ISSN); PG_RETURN_EAN13(result); }
Datum issn_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1011 of file isn.c.
References ISSN, PG_GETARG_CSTRING, PG_RETURN_EAN13, and string2ean().
{ const char *str = PG_GETARG_CSTRING(0); ean13 result; (void) string2ean(str, false, &result, ISSN); PG_RETURN_EAN13(result); }
Datum make_valid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1099 of file isn.c.
References PG_GETARG_EAN13, PG_RETURN_EAN13, and val.
{ ean13 val = PG_GETARG_EAN13(0); val &= ~((ean13) 1); PG_RETURN_EAN13(val); }
Datum upc_cast_from_ean13 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1073 of file isn.c.
References ean2isn(), PG_GETARG_EAN13, PG_RETURN_EAN13, UPC, and val.
{ ean13 val = PG_GETARG_EAN13(0); ean13 result; (void) ean2isn(val, false, &result, UPC); PG_RETURN_EAN13(result); }
Datum upc_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1024 of file isn.c.
References PG_GETARG_CSTRING, PG_RETURN_EAN13, string2ean(), and UPC.
{ const char *str = PG_GETARG_CSTRING(0); ean13 result; (void) string2ean(str, false, &result, UPC); PG_RETURN_EAN13(result); }
Datum weak_input_status | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1125 of file isn.c.
References g_weak, and PG_RETURN_BOOL.
{ PG_RETURN_BOOL(g_weak); }