Skip to content
  • Alexandre Duret-Lutz's avatar
    Massage the AST so that identical sub-formula share the same · 5f6d8b62
    Alexandre Duret-Lutz authored
    reference-counted formula*.  One can't call constructors for AST
    items anymore, everything need to be acquired through instance()
    class methods.
    * src/ltlast/, src/ltlast/,
    src/ltlast/refformula.hh: New files.
    * src/ltlast/ (libltlast_la_SOURCES): Add them.
    * src/ltlast/, src/ltlast/atomic_prop.hh,
    src/ltlast/, src/ltlast/unop.hh,
    src/ltlast/, src/ltlast/binop.hh: Make the constructor
    and destructor protected.  Define a static function `instance()'
    to get an instance with specific argument.  Use a map called
    `instances' to store all known instances.  Inherit from
    * src/ltlast/constant.hh, src/ltlast/ Protect
    the constructor and destructor.  Provide the false_instance()
    and true_instance() functions instead.
    * src/formula.hh (ref, unref, ref_, unref_): New methods.
    * src/ltlast/, src/ltlast/multop.hh: Protect
    the constructor, destructor, as well as the add() method.
    Provides the instance(), and add() class methods instead.
    Store children_ as a pointer.
    * src/ltlenv/ (require): Adjust to
    call atomic_prop::instance.
    * src/ltlparse/ltlparse.yy: Adjust to call instance() functions
    instead of constructors.
    * src/ltltest/ (LDADD): Tweak library ordering.
    * src/ltlvisit/clone.hh (clone_visitor): Inherit from visitor,
    not const_visitor, and adjust all prototypes appropriately.
    * src/ltlvisit/ (clone_visitor): Likewise.
    Call ref() or instance() methods instead of copy constructors.
    * src/ltlvisit/ Simplify atomic_prop and constant
    * src/ltlvisit/lunabbrev.hh, src/ltlvisit/,
    src/ltlvisit/tunabbrev.hh, src/ltlvisit/,
    src/ltlvisit/nenoform.hh, src/ltlvisit/ Use instance()
    methods instead of constructor.  Make these children of visitor, not
    * src/ltltest/readltl.c (main): Do not delete the formula.