X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=tests%2Fidn%2Fidn.psi;h=77afbc7fbe35277dfec5bf07804289eea918102e;hp=1583680060fd7bf54d1987ee1a2b4ae0c3ea6368;hb=2069cc3c64550fc1a263499457c2226b32b46ba7;hpb=762750b4a3f4e0471993849c4bd12965f6b62356 diff --git a/tests/idn/idn.psi b/tests/idn/idn.psi index 1583680..77afbc7 100644 --- a/tests/idn/idn.psi +++ b/tests/idn/idn.psi @@ -1,35 +1,18 @@ -# libidn +// libidn lib "idn"; -# IDNA errors -const int \IDNA_SUCCESS = 0; -const int \IDNA_STRINGPREP_ERROR = 1; -const int \IDNA_PUNYCODE_ERROR = 2; -const int \IDNA_CONTAINS_NON_LDH = 3; -const int \IDNA_CONTAINS_LDH = 3; -const int \IDNA_CONTAINS_MINUS = 4; -const int \IDNA_INVALID_LENGTH = 5; -const int \IDNA_NO_ACE_PREFIX = 6; -const int \IDNA_ROUNDTRIP_VERIFY_ERROR = 7; -const int \IDNA_CONTAINS_ACE_PREFIX = 8; -const int \IDNA_ICONV_ERROR = 9; -const int \IDNA_MALLOC_ERROR = 201; -const int \IDNA_DLOPEN_ERROR = 202; -# IDNA flags -const int \IDNA_ALLOW_UNASSIGNED = 1; -const int \IDNA_USE_STD3_ASCII_RULES = 2; +#include +#include - -default int idna_to_ascii_8z(sint8 *host, sint8 **buffer, int flags); function idn\utf8_to_ascii(string $host, string &$result, int $flags = 0) : int { - let buffer = &NULL; - let host = strval($host); + let output = &NULL; + let input = strval($host); let flags = intval($flags); - set $result = to_string(*buffer); + set $result = to_string(*output); return to_int(idna_to_ascii_8z); - free *buffer; + free free(*output); } -default sint8 *idna_strerror(int rc); + function idn\strerror(int $rc) : string { return to_string(idna_strerror); let rc = intval($rc);