• 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.6 Unifying data
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Unifying data
            • PL_unify()
            • PL_unify_atom()
            • PL_unify_bool()
            • PL_unify_chars()
            • PL_unify_atom_chars()
            • PL_unify_list_chars()
            • PL_unify_string_chars()
            • PL_unify_integer()
            • PL_unify_int64()
            • PL_unify_uint64()
            • PL_unify_float()
            • PL_unify_pointer()
            • PL_unify_functor()
            • PL_unify_compound()
            • PL_unify_list()
            • PL_unify_nil()
            • PL_unify_arg()
            • PL_unify_term()
            • PL_chars_to_term()
            • PL_wchars_to_term()
            • PL_quote()
            • PL_for_dict()
    • Packages
Availability:C-language interface function
bool PL_unify_chars(term_t ?t, int flags, size_t len, const char *chars)
New function to deal with unification of char* with various encodings to a Prolog representation. The flags argument is a bitwise or specifying the Prolog target type and the encoding of chars. A Prolog type is one of PL_ATOM, PL_STRING, PL_CODE_LIST or PL_CHAR_LIST. A representation is one of REP_ISO_LATIN_1, REP_UTF8 or REP_MB. See PL_get_chars() for a definition of the representation types. If len is -1 chars must be zero-terminated and the length is computed from chars using strlen().

If the target type is PL_ATOM and the atom does not yet exist, it is created as a thread-local atom (see PL_BLOB_LOCAL in section 12.4.10.1): the atom is only referenced from the term. This avoids global atom garbage collection for temporary atoms. It becomes an ordinary atom if another thread looks up the same text or as soon as it is stored where other threads can find it. Foreign code that keeps the atom must use PL_register_atom(), as for any atom obtained from a term. This notably applies to passing the atom to another thread (see section 12.4.2.1). Atoms created by PL_new_atom() and friends are ordinary atoms.

If flags includes PL_DIFF_LIST and type is one of PL_CODE_LIST or PL_CHAR_LIST, the text is converted to a difference list. The tail of the difference list is t+1.

ClioPatria (version V3.1.1-51-ga0b30a5)