pr29.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* pr29.h --- Detect strings which are non-idempotent under NFKC.
  2. * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon
  3. * Josefsson.
  4. *
  5. * This file is part of GNU Libidn.
  6. *
  7. * GNU Libidn is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * GNU Libidn is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with GNU Libidn; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  20. *
  21. */
  22. #ifndef PR29_H
  23. # define PR29_H
  24. # ifndef IDNAPI
  25. # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
  26. # define IDNAPI __attribute__((__visibility__("default")))
  27. # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
  28. # define IDNAPI __declspec(dllexport)
  29. # elif defined _MSC_VER && ! defined LIBIDN_STATIC
  30. # define IDNAPI __declspec(dllimport)
  31. # else
  32. # define IDNAPI
  33. # endif
  34. # endif
  35. # ifdef __cplusplus
  36. extern "C"
  37. {
  38. # endif
  39. /* Get size_t. */
  40. # include <stdlib.h>
  41. /* Get uint32_t. */
  42. # include <idn-int.h>
  43. /* Error codes. */
  44. typedef enum
  45. {
  46. PR29_SUCCESS = 0,
  47. PR29_PROBLEM = 1, /* String is a problem sequence. */
  48. PR29_STRINGPREP_ERROR = 2 /* Charset conversion failed (p29_8*). */
  49. } Pr29_rc;
  50. extern IDNAPI const char *pr29_strerror (Pr29_rc rc);
  51. extern IDNAPI int pr29_4 (const uint32_t * in, size_t len);
  52. extern IDNAPI int pr29_4z (const uint32_t * in);
  53. extern IDNAPI int pr29_8z (const char *in);
  54. # ifdef __cplusplus
  55. }
  56. # endif
  57. #endif /* PR29_H */