Header And Logo

PostgreSQL
| The world's most advanced open source database.

ISMN.h

Go to the documentation of this file.
00001 /*
00002  * ISMN.h
00003  *    PostgreSQL type definitions for ISNs (ISBN, ISMN, ISSN, EAN13, UPC)
00004  *
00005  * Information recompiled by Kronuz on November 12, 2004
00006  * http://www.ismn-international.org
00007  *
00008  * IDENTIFICATION
00009  *    contrib/isn/ISMN.h
00010  *
00011  * M-3452-4680-5 <=> (0)-3452-4680-5 <=> 0345246805 <=> 9790345246805 <=> 979-0-3452-4680-5
00012  *
00013  *             (M counts as 3)
00014  * ISMN         M   3   4    5   2   4   6    8   0
00015  * Weight       3   1   3    1   3   1   3    1   3
00016  * Product      9 + 3 + 12 + 5 + 6 + 4 + 18 + 8 + 0 = 65
00017  *              65 / 10 = 6 remainder 5
00018  * Check digit  10 - 5 = 5
00019  * => M-3452-4680-5
00020  *
00021  * ISMN         9   7    9   0   3   4    5   2   4   6    8   0
00022  * Weight       1   3    1   3   1   3    1   3   1   3    1   3
00023  * Product      9 + 21 + 9 + 0 + 3 + 12 + 5 + 6 + 4 + 18 + 8 + 0 = 95
00024  *              95 / 10 = 9 remainder 5
00025  * Check digit  10 - 5 = 5
00026  * => 979-0-3452-4680-5
00027  *
00028  * Since mod10(9*1 + 7*3 + 9*1 + 0*3) = mod10(M*3) = mod10(3*3) = 9; the check digit remains the same.
00029  *
00030  */
00031 
00032 /* where the digit set begins, and how many of them are in the table */
00033 const unsigned ISMN_index[10][2] = {
00034     {0, 5},
00035     {5, 0},
00036     {5, 0},
00037     {5, 0},
00038     {5, 0},
00039     {5, 0},
00040     {5, 0},
00041     {5, 0},
00042     {5, 0},
00043     {5, 0},
00044 };
00045 const char *ISMN_range[][2] = {
00046     {"0-000", "0-099"},
00047     {"0-1000", "0-3999"},
00048     {"0-40000", "0-69999"},
00049     {"0-700000", "0-899999"},
00050     {"0-9000000", "0-9999999"},
00051     {NULL, NULL}
00052 };