Skip to content

0.1.0

Choose a tag to compare

@landrix landrix released this 19 Oct 15:21
· 9 commits to main since this release

First release of libphonenumber-pascal: a pure Object Pascal port of Google's
libphonenumber for Delphi and
FreePascal
, built from upstream metadata release 9.0.41.

No DLL, no .NET, no external runtime: the upstream metadata is generated into
Pascal units and compiled in.

What is in it

  • PhoneNumberUtil: parsing (RFC3966, extensions, Unicode digits, vanity
    numbers), possible / valid checks, number type, region lookup, every
    format* method, isNumberMatch, example numbers and the accessory API.
  • AsYouTypeFormatter, ShortNumberInfo and PhoneNumberMatcher
    (findNumbers, all four leniency levels) - complete.
  • A metadata generator that ports upstream BuildMetadataFromXml.java; a
    metadata update is a regeneration, never a hand edit.
  • Not ported: geocoder, carrier mapper, time zone mapper.

Tested configurations

  • Delphi 13, Win64.
  • FreePascal in {$MODE DELPHI}: 3.2.2, 3.2.4 and 3.3.1 on Linux aarch64;
    3.3.1 on Windows aarch64; 3.2.4 on macOS aarch64; 3.2.2 on Linux x86_64
    (CI).
  • On FreePascal, non ASCII input needs SetMultiByteConversionCodePage(CP_UTF8)
    and, on Unix, cwstring in the program; see
    README, FreePascal.

How correctness is established

  • Tests ported from the four upstream test classes run against the upstream
    test metadata with the Java expected values: PhoneNumberUtilTest 115 of
    121, PhoneNumberMatcherTest 45 of 46, ShortNumberInfoTest and
    AsYouTypeFormatterTest complete. The few unported methods test private
    parse steps, a metadata loader that can fail, proto fields the port does
    not model, or Iterator.remove()
    (KNOWN_ISSUES.md).
  • One test suite (555 tests) runs unchanged on Delphi and on FreePascal.
  • Production tests take their expected values from the C# port
    libphonenumber-csharp 9.0.41; where it differs from the Java original
    (mostly in the matcher), Java wins and the case is pinned as a documented
    divergence.
  • Mass differential against that C# port: all 1144 example numbers of the
    metadata x 9 answers (parse, four formats, possible, valid, type, region),
    0 findings.
  • A FreePascal runtime gate checks that a Delphi build and a FreePascal build
    of one driver produce byte identical output over a fixed regression corpus
    (every example number, short number, as-you-type sequence and matcher text,
    every compiled metadata pattern, and more).

See the
README
for usage and the
CHANGELOG
for the full list. Wrong number data is almost always an upstream metadata
issue; see
CONTRIBUTING.md.