/* Copyright (c) 2015 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #pragma once #include "kernel/environment.h" #include "library/io_state.h" #ifndef LEAN_DEFAULT_PRIORITY #define LEAN_DEFAULT_PRIORITY 1000u #endif namespace lean { typedef std::function set_attribute_proc; typedef std::function set_prio_attribute_proc; typedef std::function set_param_attribute_proc; typedef std::function const &, name const &, bool)> set_opt_param_attribute_proc; typedef std::function const &, name const &, bool)> set_params_attribute_proc; typedef std::function has_attribute_proc; // NOLINT typedef std::function get_attribute_prio_proc; typedef std::function get_attribute_param_proc; typedef std::function(environment const &, name const &)> get_attribute_params_proc; void register_attribute(char const * attr, char const * descr, set_attribute_proc const & setter, has_attribute_proc const & tester); void register_prio_attribute(char const * attr, char const * descr, set_prio_attribute_proc const & setter, has_attribute_proc const & tester, get_attribute_prio_proc const & getter); void register_opt_param_attribute(char const * attr, char const * descr, set_opt_param_attribute_proc const & setter, has_attribute_proc const & tester, get_attribute_param_proc const & getter); void register_param_attribute(char const * attr, char const * descr, set_param_attribute_proc const & setter, has_attribute_proc const & tester, get_attribute_param_proc const & getter); void register_params_attribute(char const * attr, char const * descr, set_params_attribute_proc const & setter, has_attribute_proc const & tester, get_attribute_params_proc const & getter); void register_incompatible(char const * attr1, char const * attr2); enum class attribute_kind { Default, Prioritized, Parametric, OptParametric, MultiParametric }; bool is_attribute(char const * attr); void get_attributes(buffer &); void get_attribute_tokens(buffer &); char const * get_attribute_from_token(char const * attr_token); char const * get_attribute_token(char const * attr); attribute_kind get_attribute_kind (char const * attr); environment set_attribute(environment const & env, io_state const & ios, char const * attr, name const & d, name const & ns, bool persistent); environment set_prio_attribute(environment const & env, io_state const & ios, char const * attr, name const & d, unsigned prio, name const & ns, bool persistent); environment set_param_attribute(environment const & env, io_state const & ios, char const * attr, name const & d, unsigned param, name const & ns, bool persistent); environment set_opt_param_attribute(environment const & env, io_state const & ios, char const * attr, name const & d, optional const & param, name const & ns, bool persistent); environment set_params_attribute(environment const & env, io_state const & ios, char const * attr, name const & d, list const & params, name const & ns, bool persistent); bool has_attribute(environment const & env, char const * attr, name const & d); unsigned get_attribute_prio(environment const & env, char const * attr, name const & d); unsigned get_attribute_param(environment const & env, char const * attr, name const & d); list get_attribute_params(environment const & env, char const * attr, name const & d); bool are_incompatible(char const * attr1, char const * attr2); void initialize_attribute_manager(); void finalize_attribute_manager(); }