• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

12.4.3 Analysing Terms via the Foreign Interface
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Analysing Terms via the Foreign Interface
            • Testing the type of a term
            • Reading data from a term
            • Exchanging text using length and string
            • Wide-character versions
              • PL_new_atom_wchars()
              • PL_atom_wchars()
              • PL_get_wchars()
              • PL_put_wchars()
              • PL_unify_wchars()
              • PL_unify_wchars_diff()
            • Reading a list
            • Processing option lists and dicts
            • An example: defining write/1 in C
    • Packages
_chars().
int PL_get_nchars(term_t t, size_t *len, char **s, unsigned int flags)
See PL_get_chars(). The len pointer may be NULL.
int PL_put_atom_nchars(term_t t, size_t len, const char *s)
See PL_put_atom_chars().
int PL_put_string_nchars(term_t t, size_t len, const char *s)
See PL_put_string_chars().
int PL_put_list_ncodes(term_t t, size_t len, const char *s)
See PL_put_list_codes().
int PL_put_list_nchars(term_t t, size_t len, const char *s)
See PL_put_list_chars().
int PL_unify_atom_nchars(term_t t, size_t len, const char *s)
See PL_unify_atom_chars().
int PL_unify_string_nchars(term_t t, size_t len, const char *s)
See PL_unify_string_chars().
int PL_unify_list_ncodes(term_t t, size_t len, const char *s)
See PL_unify_codes().
int PL_unify_list_nchars(term_t t, size_t len, const char *s)
See PL_unify_list_chars().

In addition, the following functions are available for creating and inspecting atoms:

atom_t PL_new_atom_nchars(size_t len, const char *s)
Create a new atom as PL_new_atom(), but using the given length and characters. If len is (size_t)-1, it is computed from s using strlen(). See PL_new_atom() for error handling.
const char * PL_atom_nchars(atom_t a, size_t *len)
Extract the text and length of an atom. If you do not need the length, pass NULL as the value of len. If PL_atom_nchars() is called for a blob, NULL is returned.

12.4.4.4 Wide-character versions

Support for exchange of wide-character strings is still under consideration. The functions dealing with 8-bit character strings return failure when operating on a wide-character atom or Prolog string object. The functions below can extract and unify both 8-bit and wide atoms and string objects. Wide character strings are represented as C arrays of objects of the type pl_wchar_t, which is guaranteed to be the same as wchar_t on platforms supporting this type. For example, on MS-Windows, this represents a 16-bit UTF-16 string, while using the GNU C library (glibc) this represents 32-bit UCS4 characters.

atom_t PL_new_atom_wchars(size

ClioPatria (version V3.1.1-42-gd6a756b-DIRTY)