• 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.2 Atoms and functors
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Atoms and functors
            • PL_new_atom()
            • PL_new_atom_mbchars()
            • PL_atom_chars()
            • PL_new_functor()
            • PL_functor_name()
            • PL_functor_arity()
            • Atoms and atom garbage collection
              • PL_register_atom()
              • PL_unregister_atom()
    • Packages
L_atom_wchars()">PL_atom_wchars() to obtain a C wide string (wchar_t).
functor_t PL_new_functor(atom_t name, int arity)
Returns a functor identifier, a handle for the name/arity pair. The returned handle is valid for the entire Prolog session. Future versions may garbage collect functors as part of atom garbage collection. Currently aborts the process with a fatal error on failure. Future versions may raise a resource exception and return (atom_t)0.
atom_t PL_functor_name(functor_t f)
Return an atom representing the name of the given functor.
size_t PL_functor_arity(functor_t f)
Return the arity of the given functor.

12.4.2.1 Atoms and atom garbage collection

With the introduction of atom garbage collection in version 3.3.0, atoms no longer live as long as the process. Instead, their lifetime is guaranteed only as long as they are referenced. In the single-threaded version, atom garbage collections are only invoked at the call-port. In the multithreaded version (see chapter 10), they appear asynchronously, except for the invoking thread.

For dealing with atom garbage collection, two additional functions are provided:

void PL_register_atom(atom_t atom)
Increment the

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