Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni-vonage committed Mar 15, 2024
1 parent de69903 commit c345825
Show file tree
Hide file tree
Showing 31 changed files with 56 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: set RELEASE number
run: echo ${GITHUB_RUN_NUMBER} > RELEASE
- name: test
run: cd javascript && make test build
run: cd javascript && make build

python:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Also includes:


* **category** Library
* **copyright** 2019-2023 Vonage
* **copyright** 2019-2024 Vonage
* **license** [MIT](https://github.com/Vonage/numkey/blob/main/LICENSE)
* **link** https://github.com/Vonage/numkey

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.25
1.5.26
2 changes: 1 addition & 1 deletion c/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME = "NumKey"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 1.5.25
PROJECT_NUMBER = 1.5.26

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
2 changes: 1 addition & 1 deletion c/nk/nk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// nk.c
//
// @category Tools
// @author Nicola Asuni <[email protected]>
// @author Nicola Asuni
// @copyright 2019 Vonage
// @license see LICENSE file
// @link https://github.com/Vonage/numkey
Expand Down
2 changes: 1 addition & 1 deletion c/resources/debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
https://github.com/Vonage/numkey
commit history

-- Nicola Asuni <[email protected]> ~#DATE#~
-- Nicola Asuni ~#DATE#~
2 changes: 1 addition & 1 deletion c/src/numkey/binsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// @author Nicola Asuni <[email protected]>
// @link https://github.com/tecnickcom/binsearch
// @license MIT (see https://raw.githubusercontent.com/tecnickcom/binsearch/main/LICENSE)
// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com
// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com

/**
* @file binsearch.h
Expand Down
3 changes: 1 addition & 2 deletions c/src/numkey/countrykey.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// countrykey.h
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions c/src/numkey/numkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// numkey.h
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions c/src/numkey/prefixkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// prefixkey.h
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2022-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
2 changes: 1 addition & 1 deletion c/test/test_binsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// @author Nicola Asuni <[email protected]>
// @link https://github.com/tecnickcom/binsearch
// @license MIT (see LICENSE file)
// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com
// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com

#if __STDC_VERSION__ >= 199901L
#define _XOPEN_SOURCE 600
Expand Down
2 changes: 1 addition & 1 deletion c/test/test_binsearch_col.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// @author Nicola Asuni <[email protected]>
// @link https://github.com/tecnickcom/binsearch
// @license MIT (see LICENSE file)
// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com
// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com

#if __STDC_VERSION__ >= 199901L
#define _XOPEN_SOURCE 600
Expand Down
2 changes: 1 addition & 1 deletion c/test/test_binsearch_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// @author Nicola Asuni <[email protected]>
// @link https://github.com/tecnickcom/binsearch
// @license MIT (see LICENSE file)
// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com
// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com

#if __STDC_VERSION__ >= 199901L
#define _XOPEN_SOURCE 600
Expand Down
3 changes: 1 addition & 2 deletions c/test/test_countrykey.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// test_countrykey.c
//
// @category Tools
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @lick https://github.com/Vonage/countrykey

Expand Down
3 changes: 1 addition & 2 deletions c/test/test_numkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// test_numkey.c
//
// @category Tools
// @author Nicola Asuni <[email protected]>
// @copyright 2019 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions c/test/test_prefixkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// test_prefixkey.c
//
// @category Tools
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions cgo/src/countrykey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// countrykey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @lick https://github.com/Vonage/countrykey

Expand Down
3 changes: 1 addition & 2 deletions cgo/src/numkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// 64 bit Encoding for Short Codes and E.164 LVN.
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey
package numkey
Expand Down
3 changes: 1 addition & 2 deletions cgo/src/numkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// numkey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions cgo/src/prefixkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// prefixkey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions go/src/countrykey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// countrykey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @lick https://github.com/Vonage/countrykey

Expand Down
3 changes: 1 addition & 2 deletions go/src/numkey.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Package numkey provides 64 bit Encoding for Short Codes and E.164 LVN.
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2020 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey
package numkey
Expand Down
3 changes: 1 addition & 2 deletions go/src/numkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// numkey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions go/src/prefixkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package numkey

// prefixkey_test.go
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
5 changes: 2 additions & 3 deletions javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ all: clean format test build

# Build a minified version of the library
.PHONY: build
build:
build: test
@mkdir -p target/build
uglifyjs --compress --keep-fnames --comments --output target/build/numkey.js src/numkey.js
cd test && node test_numkey.js '../target/build/numkey.js'
uglifyjs --compress --keep-fnames --comments --output target/build/numkey.js src/numkey.js

# Remove any build artifact
.PHONY: clean
Expand Down
51 changes: 25 additions & 26 deletions javascript/src/numkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,42 @@
* numkey.js
*
* @category Libraries
* @author Nicola Asuni <[email protected]>
* @copyright 2019-2020 Vonage
* @author Nicola Asuni
* @license see LICENSE file
* @link https://github.com/Vonage/numkey
*/

// NOTE: Javascript numbers are 64 bit floats with a 53 bit precision.

var NKBMASK_COUNTRY_FL = 0xF8000000 //!< Bit mask for the ISO 3166 alpha-2 country code first letter [ 11111000 00000000 00000000 00000000 ]
var NKBMASK_COUNTRY_SL = 0x07C00000 //!< Bit mask for the ISO 3166 alpha-2 country code second letter [ 00000111 11000000 00000000 00000000 ]
const NKBMASK_COUNTRY_FL = 0xF8000000 //!< Bit mask for the ISO 3166 alpha-2 country code first letter [ 11111000 00000000 00000000 00000000 ]
const NKBMASK_COUNTRY_SL = 0x07C00000 //!< Bit mask for the ISO 3166 alpha-2 country code second letter [ 00000111 11000000 00000000 00000000 ]

var NKBMASK_NUMBER_HI = 0x003FFFFF //!< Bit mask for the hi part of short code or E.164 number (max 15 digits) [ 00000000 00111111 11111111 11111111 ]
var NKBMASK_NUMBER_LO = 0xFFFFFFF0 //!< Bit mask for the lo part of short code or E.164 number (max 15 digits) [ 11111111 11111111 11111111 11110000 ]
const NKBMASK_NUMBER_HI = 0x003FFFFF //!< Bit mask for the hi part of short code or E.164 number (max 15 digits) [ 00000000 00111111 11111111 11111111 ]
const NKBMASK_NUMBER_LO = 0xFFFFFFF0 //!< Bit mask for the lo part of short code or E.164 number (max 15 digits) [ 11111111 11111111 11111111 11110000 ]

var NKBMASK_32 = 0xFFFFFFFF //!< 32-Bit mask [ 11111111 11111111 11111111 11111111 ]
const NKBMASK_32 = 0xFFFFFFFF //!< 32-Bit mask [ 11111111 11111111 11111111 11111111 ]

var NKBMASK_LENGTH = 0x0000000F //!< Bit mask for the number length [ 00000000 00000000 00000000 00001111 ]
const NKBMASK_LENGTH = 0x0000000F //!< Bit mask for the number length [ 00000000 00000000 00000000 00001111 ]

var NKBSHIFT_COUNTRY_FL = 27 //!< COUNTRY first letter LSB position from the NumKey LSB
var NKBSHIFT_COUNTRY_SL = 22 //!< COUNTRY second letter LSB position from the NumKey LSB
const NKBSHIFT_COUNTRY_FL = 27 //!< COUNTRY first letter LSB position from the NumKey LSB
const NKBSHIFT_COUNTRY_SL = 22 //!< COUNTRY second letter LSB position from the NumKey LSB

var NKBSHIFT_NUMBER_HI = 10 //!< NUMBER MSB position from the NumKey MSB
var NKBSHIFT_NUMBER_LO = 4 //!< NUMBER LSB position from the NumKey LSB
const NKBSHIFT_NUMBER_HI = 10 //!< NUMBER MSB position from the NumKey MSB
const NKBSHIFT_NUMBER_LO = 4 //!< NUMBER LSB position from the NumKey LSB

var NKSLENGTH_COUNTRY = 3 //!< Number of characters in the country code + NULL terminator
var NKSLENGTH_NUMBER = 16 //!< Number of characters in the number code + NULL terminator
const NKSLENGTH_COUNTRY = 3 //!< Number of characters in the country code + NULL terminator
const NKSLENGTH_NUMBER = 16 //!< Number of characters in the number code + NULL terminator

var NKCSHIFT_CHAR = 64 //!< Value shift to encode characters to numbers (A=1, ..., Z=26)
const NKCSHIFT_CHAR = 64 //!< Value shift to encode characters to numbers (A=1, ..., Z=26)

var NKNUMDIV = 0x10000000 //!< = [2^28] divider to get the number HI bits
var NKNUMMUL = 0x100000000 //!< = [2^32] multiplier to set the number HI bits
const NKNUMDIV = 0x10000000 //!< = [2^28] divider to get the number HI bits
const NKNUMMUL = 0x100000000 //!< = [2^32] multiplier to set the number HI bits

var NKZEROSHIFT = 48 //!< ASCII code of the '0' character
const NKZEROSHIFT = 48 //!< ASCII code of the '0' character

var NKNUMMAXLEN = 15 //!< Maximum number length for E.164 and key reversibility
const NKNUMMAXLEN = 15 //!< Maximum number length for E.164 and key reversibility

var PKNUMMAXLEN = 15 //!< Maximum number of digits to store for the prefixkey.
const PKNUMMAXLEN = 15 //!< Maximum number of digits to store for the prefixkey.

function encodeChar(c) {
return ((c - NKCSHIFT_CHAR) >>> 0)
Expand All @@ -54,7 +53,7 @@ function decodeCountry(nk) {
}

function encodeNumber(number) {
var size = number.length;
const size = number.length;
if (size < 1) {
return {
"hi": 0,
Expand All @@ -80,13 +79,13 @@ function encodeNumber(number) {
}

function decodeNumber(nk) {
var size = (nk.lo & NKBMASK_LENGTH) >>> 0;
const size = (nk.lo & NKBMASK_LENGTH) >>> 0;
if (size == 0) {
return "";
}
var number = new Array(size);
var numhi = ((nk.hi & NKBMASK_NUMBER_HI) >>> 0);
var numlo = ((nk.lo & NKBMASK_NUMBER_LO) >>> 0);
const number = new Array(size);
const numhi = ((nk.hi & NKBMASK_NUMBER_HI) >>> 0);
const numlo = ((nk.lo & NKBMASK_NUMBER_LO) >>> 0);
var num = ((numhi >>> NKBSHIFT_NUMBER_LO) * NKNUMMUL) + (((numhi << (32 - NKBSHIFT_NUMBER_LO)) >>> 0) + (numlo >>> NKBSHIFT_NUMBER_LO));
var rem = 0;
var i;
Expand All @@ -99,7 +98,7 @@ function decodeNumber(nk) {
}

function numKey(country, number) {
var ne = encodeNumber(number);
const ne = encodeNumber(number);
return {
"hi": ((encodeCountry(country) | ne.hi) >>> 0),
"lo": ne.lo
Expand Down
2 changes: 1 addition & 1 deletion javascript/test/test_numkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* test_numkey.js
*
* @category Libraries
* @author Nicola Asuni <[email protected]>
* @author Nicola Asuni
* @copyright 2019 Vonage
* @license see LICENSE file
* @link https://github.com/Vonage/numkey
Expand Down
3 changes: 1 addition & 2 deletions python/numkey/pynumkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// pynumkey.c
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019-2022 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
3 changes: 1 addition & 2 deletions python/numkey/pynumkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// pynumkey.h
//
// @category Libraries
// @author Nicola Asuni <[email protected]>
// @copyright 2019 Vonage
// @author Nicola Asuni
// @license see LICENSE file
// @link https://github.com/Vonage/numkey

Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run(self):

setup(
name="numkey",
version="1.5.25.1",
version="1.5.26.1",
keywords=("numkey E.164 shortcode lvn did encoding"),
description="NumKey Bindings for Python",
long_description=read("../README.md"),
Expand Down
2 changes: 1 addition & 1 deletion python/test/test_numkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# test_numkey.py
# @category Libraries
# @author Nicola Asuni <[email protected]>
# @author Nicola Asuni
# @copyright 2019 Vonage
# @license see LICENSE file
# @link https://github.com/Vonage/numkey
Expand Down

0 comments on commit c345825

Please sign in to comment.