xo-expression2: + DGlobalSymtab facet support gen + files
This commit is contained in:
parent
fc4bfafa0a
commit
06521e5e79
15 changed files with 400 additions and 5 deletions
|
|
@ -68,6 +68,41 @@ xo_add_genfacetimpl(
|
|||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-symboltable-globalsymtab
|
||||
FACET_PKG xo_expression2
|
||||
FACET SymbolTable
|
||||
REPR GlobalSymtab
|
||||
INPUT idl/ISymbolTable_DGlobalSymtab.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR symtab
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-gcobject-globalsymtab
|
||||
FACET_PKG xo_gc
|
||||
FACET GCObject
|
||||
REPR GlobalSymtab
|
||||
INPUT idl/IGCObject_DGlobalSymtab.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR symtab
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-printable-globalsymtab
|
||||
FACET_PKG xo_printable2
|
||||
FACET Printable
|
||||
REPR GlobalSymtab
|
||||
INPUT idl/IPrintable_DGlobalSymtab.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR symtab
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacet(
|
||||
TARGET xo-expression2-facet-expression
|
||||
|
|
|
|||
16
idl/IGCObject_DGlobalSymtab.json5
Normal file
16
idl/IGCObject_DGlobalSymtab.json5
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/expression2",
|
||||
includes: [
|
||||
"<xo/gc/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>"
|
||||
],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/GCObject.json5",
|
||||
brief: "provide AGCObject interface for DGlobalSymtab",
|
||||
using_doxygen: true,
|
||||
repr: "DGlobalSymtab",
|
||||
doc: [ "implement AGCObject for DGlobalSymtab" ],
|
||||
}
|
||||
14
idl/IPrintable_DGlobalSymtab.json5
Normal file
14
idl/IPrintable_DGlobalSymtab.json5
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/expression2",
|
||||
includes: [ "<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/Printable.json5",
|
||||
brief: "provide APrintable interface for DGlobalSymtab",
|
||||
using_doxygen: true,
|
||||
repr: "DGlobalSymtab",
|
||||
doc: [ "implement APrintable for DGlobalSymtab" ],
|
||||
}
|
||||
13
idl/ISymbolTable_DGlobalSymtab.json5
Normal file
13
idl/ISymbolTable_DGlobalSymtab.json5
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/expression2",
|
||||
includes: [ ],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/SymbolTable.json5",
|
||||
brief: "provide ASymbolTable interface for DGlobalSymtab",
|
||||
using_doxygen: true,
|
||||
repr: "DGlobalSymtab",
|
||||
doc: [ "implement ASymbolTable for DGlobalSymtab" ],
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ namespace xo {
|
|||
using ACollector = xo::mm::ACollector;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
|
||||
public:
|
||||
/** @defgroup scm-globalsymtab-ctors constructors **/
|
||||
|
|
@ -91,6 +92,13 @@ namespace xo {
|
|||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-globalsymtab-printable-facet printable facet **/
|
||||
///@{
|
||||
|
||||
/** pretty-printing support **/
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
/** map symbols -> bindings.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "DGlobalSymtab.hpp"
|
||||
//#include "symtab/ISymbolTable_DGlobalSymtab.hpp"
|
||||
//#include "symtab/IGCObject_DGlobalSymtab.hpp"
|
||||
//#include "symtab/IPrintable_DGlobalSymtab.hpp"
|
||||
#include "symtab/ISymbolTable_DGlobalSymtab.hpp"
|
||||
#include "symtab/IGCObject_DGlobalSymtab.hpp"
|
||||
#include "symtab/IPrintable_DGlobalSymtab.hpp"
|
||||
|
||||
/* end GlobalSymtab.hpp */
|
||||
|
|
|
|||
67
include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp
Normal file
67
include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/** @file IGCObject_DGlobalSymtab.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DGlobalSymtab; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DGlobalSymtab>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DGlobalSymtab,
|
||||
xo::scm::IGCObject_DGlobalSymtab>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IGCObject_DGlobalSymtab
|
||||
**/
|
||||
class IGCObject_DGlobalSymtab {
|
||||
public:
|
||||
/** @defgroup scm-gcobject-dglobalsymtab-type-traits **/
|
||||
///@{
|
||||
using size_type = xo::mm::AGCObject::size_type;
|
||||
using AAllocator = xo::mm::AGCObject::AAllocator;
|
||||
using ACollector = xo::mm::AGCObject::ACollector;
|
||||
using Copaque = xo::mm::AGCObject::Copaque;
|
||||
using Opaque = xo::mm::AGCObject::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-gcobject-dglobalsymtab-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DGlobalSymtab & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DGlobalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DGlobalSymtab & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
62
include/xo/expression2/symtab/IPrintable_DGlobalSymtab.hpp
Normal file
62
include/xo/expression2/symtab/IPrintable_DGlobalSymtab.hpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/** @file IPrintable_DGlobalSymtab.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Printable.hpp"
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#include "DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IPrintable_DGlobalSymtab; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::print::APrintable,
|
||||
xo::scm::DGlobalSymtab>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DGlobalSymtab,
|
||||
xo::scm::IPrintable_DGlobalSymtab>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IPrintable_DGlobalSymtab
|
||||
**/
|
||||
class IPrintable_DGlobalSymtab {
|
||||
public:
|
||||
/** @defgroup scm-printable-dglobalsymtab-type-traits **/
|
||||
///@{
|
||||
using ppindentinfo = xo::print::APrintable::ppindentinfo;
|
||||
using Copaque = xo::print::APrintable::Copaque;
|
||||
using Opaque = xo::print::APrintable::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-printable-dglobalsymtab-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** Pretty-printing support for this object.
|
||||
See [xo-indentlog/xo/indentlog/pretty.hpp] **/
|
||||
static bool pretty(const DGlobalSymtab & self, const ppindentinfo & ppii);
|
||||
|
||||
// non-const methods
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
60
include/xo/expression2/symtab/ISymbolTable_DGlobalSymtab.hpp
Normal file
60
include/xo/expression2/symtab/ISymbolTable_DGlobalSymtab.hpp
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/** @file ISymbolTable_DGlobalSymtab.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISymbolTable_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISymbolTable_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SymbolTable.hpp"
|
||||
#include "DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo { namespace scm { class ISymbolTable_DGlobalSymtab; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::ASymbolTable,
|
||||
xo::scm::DGlobalSymtab>
|
||||
{
|
||||
using ImplType = xo::scm::ISymbolTable_Xfer
|
||||
<xo::scm::DGlobalSymtab,
|
||||
xo::scm::ISymbolTable_DGlobalSymtab>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class ISymbolTable_DGlobalSymtab
|
||||
**/
|
||||
class ISymbolTable_DGlobalSymtab {
|
||||
public:
|
||||
/** @defgroup scm-symboltable-dglobalsymtab-type-traits **/
|
||||
///@{
|
||||
using Copaque = xo::scm::ASymbolTable::Copaque;
|
||||
using Opaque = xo::scm::ASymbolTable::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-symboltable-dglobalsymtab-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** true iff this is toplevel (global) symbol table. **/
|
||||
static bool is_global_symtab(const DGlobalSymtab & self) noexcept;
|
||||
/** report ingredients needed to address variable at runtime. **/
|
||||
static Binding lookup_binding(const DGlobalSymtab & self, const DUniqueString * sym) noexcept;
|
||||
|
||||
// non-const methods
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -58,6 +58,9 @@ set(SELF_SRCS
|
|||
IPrintable_DLocalSymtab.cpp
|
||||
|
||||
DGlobalSymtab.cpp
|
||||
ISymbolTable_DGlobalSymtab.cpp
|
||||
IGCObject_DGlobalSymtab.cpp
|
||||
IPrintable_DGlobalSymtab.cpp
|
||||
|
||||
StringTable.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,18 @@ namespace xo {
|
|||
return this->shallow_size();
|
||||
}
|
||||
|
||||
// ----- printable facet -----
|
||||
|
||||
bool
|
||||
DGlobalSymtab::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DGlobalSymtab",
|
||||
refrtag("nsym", vars_->size()),
|
||||
refrtag("capacity", vars_->capacity()));
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
39
src/expression2/IGCObject_DGlobalSymtab.cpp
Normal file
39
src/expression2/IGCObject_DGlobalSymtab.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DGlobalSymtab.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#include "symtab/IGCObject_DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::shallow_size(const DGlobalSymtab & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::shallow_copy(const DGlobalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::forward_children(DGlobalSymtab & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DGlobalSymtab.cpp */
|
||||
28
src/expression2/IPrintable_DGlobalSymtab.cpp
Normal file
28
src/expression2/IPrintable_DGlobalSymtab.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DGlobalSymtab.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#include "symtab/IPrintable_DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DGlobalSymtab::pretty(const DGlobalSymtab & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DGlobalSymtab.cpp */
|
||||
34
src/expression2/ISymbolTable_DGlobalSymtab.cpp
Normal file
34
src/expression2/ISymbolTable_DGlobalSymtab.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/** @file ISymbolTable_DGlobalSymtab.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISymbolTable_DGlobalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISymbolTable_DGlobalSymtab.json5]
|
||||
**/
|
||||
|
||||
#include "symtab/ISymbolTable_DGlobalSymtab.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
ISymbolTable_DGlobalSymtab::is_global_symtab(const DGlobalSymtab & self) noexcept -> bool
|
||||
{
|
||||
return self.is_global_symtab();
|
||||
}
|
||||
|
||||
auto
|
||||
ISymbolTable_DGlobalSymtab::lookup_binding(const DGlobalSymtab & self, const DUniqueString * sym) noexcept -> Binding
|
||||
{
|
||||
return self.lookup_binding(sym);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISymbolTable_DGlobalSymtab.cpp */
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
#include "expression2_register_facets.hpp"
|
||||
|
||||
#include <xo/expression2/UniqueString.hpp>
|
||||
#include <xo/expression2/detail/IGCObject_DUniqueString.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DUniqueString.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DUniqueString.hpp>
|
||||
//#include <xo/expression2/detail/IPrintable_DUniqueString.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DDefineExpr.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DDefineExpr.hpp>
|
||||
|
|
@ -101,6 +101,10 @@ namespace xo {
|
|||
FacetRegistry::register_impl<AGCObject, DLocalSymtab>();
|
||||
FacetRegistry::register_impl<APrintable, DLocalSymtab>();
|
||||
|
||||
FacetRegistry::register_impl<ASymbolTable, DGlobalSymtab>();
|
||||
FacetRegistry::register_impl<AGCObject, DGlobalSymtab>();
|
||||
FacetRegistry::register_impl<APrintable, DGlobalSymtab>();
|
||||
|
||||
// until we register facets
|
||||
TypeRegistry::register_type<DGlobalSymtab>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue