Documentation updates and namespace reorg for docs.

This commit is contained in:
Jason Turner
2011-04-02 20:52:49 -06:00
parent d22a77503c
commit 0d238b1617
11 changed files with 107 additions and 103 deletions

View File

@@ -27,8 +27,10 @@
/// \namespace chaiscript
/// The chaiscript namespace contains every API call that the average user will be concerned with.
/// \brief Every API call that the average user will be concerned with.
/// \namespace chaiscript::detail
/// \brief Classes and functions reserved for internal use. Items in this namespace are not supported.
#include "dispatchkit/dispatchkit.hpp"
#include "dispatchkit/bootstrap.hpp"

View File

@@ -16,6 +16,7 @@
namespace chaiscript
{
/// \brief Classes and functions useful for bootstrapping of ChaiScript and adding of new types
namespace bootstrap
{
namespace detail

View File

@@ -17,10 +17,7 @@
namespace chaiscript
{
/**
* Object which attempts to convert a Boxed_Value into a generic
* POD type and provide generic POD type operations
*/
/// \brief Represents any numeric type, generically. Used internally for generic operations between POD values
class Boxed_POD_Value
{
public:

View File

@@ -23,12 +23,8 @@
namespace chaiscript
{
/**
* Boxed_Value is the main tool of the dispatchkit. It allows
* for boxed / untyped containment of any C++ object. It uses
* boost::any internally but also provides user access the underlying
* stored type information
*/
/// \brief A wrapper for holding any valid C++ type. All types in ChaiScript are Boxed_Value objects
/// \sa chaiscript::boxed_cast
class Boxed_Value
{
public:

View File

@@ -26,8 +26,14 @@
#include "dynamic_object.hpp"
#include "../chaiscript_threading.hpp"
/// \namespace chaiscript::dispatch
/// \brief Classes and functions specific to the runtime dispatch side of ChaiScript. Some items may be of use to the end user.
namespace chaiscript
{
/// \brief Holds a collection of ChaiScript settings which can be applied to the ChaiScript runtime.
/// Used to implement loadable module support.
class Module
{
public:
@@ -109,6 +115,7 @@ namespace chaiscript
}
};
/// Convenience typedef for Module objects to be added to the ChaiScript runtime
typedef boost::shared_ptr<Module> ModulePtr;
namespace detail

View File

@@ -31,9 +31,7 @@ namespace chaiscript
};
}
/**
* compile time deduced information about a type
*/
/// \brief Compile time deduced information about a type
class Type_Info
{
public:

View File

@@ -14,9 +14,7 @@ namespace chaiscript
{
typedef ModulePtr (*Create_Module_Func)();
/**
* Types of AST nodes available to the parser and eval
*/
/// Types of AST nodes available to the parser and eval
class AST_Node_Type {
public:
enum Type { Error, Int, Float, Id, Char, Str, Eol, Fun_Call, Inplace_Fun_Call, Arg_List, Variable, Equation, Var_Decl,
@@ -43,9 +41,7 @@ namespace chaiscript
}
}
/**
* Convenience type for file positions
*/
/// \brief Convenience type for file positions
struct File_Position {
int line;
int column;
@@ -58,6 +54,8 @@ namespace chaiscript
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
/// \brief Classes which may be thrown during error cases when ChaiScript is executing.
namespace exception
{
/**
@@ -99,9 +97,8 @@ namespace chaiscript
}
/**
* The struct that doubles as both a parser ast_node and an AST node
*/
/// \brief Struct that doubles as both a parser ast_node and an AST node.
struct AST_Node : boost::enable_shared_from_this<AST_Node> {
public:
const std::string text;
@@ -171,9 +168,8 @@ namespace chaiscript
};
namespace eval
{
namespace detail
{
/**
@@ -214,7 +210,7 @@ namespace chaiscript
chaiscript::detail::Dispatch_Engine &m_de;
};
}
}
}

View File

@@ -219,6 +219,8 @@ namespace chaiscript
typedef boost::shared_ptr<Loadable_Module> Loadable_Module_Ptr;
}
/// \brief The main object that the ChaiScript user will use.
class ChaiScript {
mutable chaiscript::detail::threading::shared_mutex m_mutex;
@@ -248,7 +250,7 @@ namespace chaiscript
return Boxed_Value();
}
}
catch (const detail::Return_Value &rv) {
catch (const chaiscript::eval::detail::Return_Value &rv) {
return rv.retval;
}
}

View File

@@ -12,13 +12,17 @@
#include <chaiscript/language/chaiscript_common.hpp>
namespace chaiscript
{
/// \brief Classes and functions that are part of the runtime eval system
namespace eval
{
namespace detail
{
/**
* Helper function that will set up the scope around a function call, including handling the named function parameters
*/
template <typename Eval_System>
const Boxed_Value eval_function (Eval_System &t_ss, const AST_NodePtr &t_node, const std::vector<std::string> &t_param_names, const std::vector<Boxed_Value> &t_vals) {
detail::Scope_Push_Pop spp(t_ss);
static const Boxed_Value eval_function(chaiscript::detail::Dispatch_Engine &t_ss, const AST_NodePtr &t_node, const std::vector<std::string> &t_param_names, const std::vector<Boxed_Value> &t_vals) {
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
for (unsigned int i = 0; i < t_param_names.size(); ++i) {
t_ss.add_object(t_param_names[i], t_vals[i]);
@@ -30,10 +34,8 @@ namespace chaiscript
return rv.retval;
}
}
}
namespace eval
{
struct Binary_Operator_AST_Node : public AST_Node {
public:
Binary_Operator_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Bitwise_Xor, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
@@ -485,7 +487,7 @@ namespace chaiscript
}
return Boxed_Value(Proxy_Function(new dispatch::Dynamic_Proxy_Function
(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>, boost::ref(t_ss), this->children.back(), t_param_names, _1),
(boost::bind(chaiscript::eval::detail::eval_function, boost::ref(t_ss), this->children.back(), t_param_names, _1),
static_cast<int>(numparams), this->children.back())));
}
@@ -499,7 +501,7 @@ namespace chaiscript
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
const size_t num_children = this->children.size();
detail::Scope_Push_Pop spp(t_ss);
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
for (size_t i = 0; i < num_children; ++i) {
try {
@@ -510,7 +512,7 @@ namespace chaiscript
return retval;
}
}
catch (const chaiscript::detail::Return_Value &) {
catch (const chaiscript::eval::detail::Return_Value &) {
throw;
}
}
@@ -552,7 +554,7 @@ namespace chaiscript
boost::shared_ptr<dispatch::Dynamic_Proxy_Function> guard;
if (guardnode) {
guard = boost::shared_ptr<dispatch::Dynamic_Proxy_Function>
(new dispatch::Dynamic_Proxy_Function(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>,
(new dispatch::Dynamic_Proxy_Function(boost::bind(chaiscript::eval::detail::eval_function,
boost::ref(t_ss), guardnode,
t_param_names, _1), static_cast<int>(numparams), guardnode));
}
@@ -561,7 +563,7 @@ namespace chaiscript
const std::string & l_function_name = this->children[0]->text;
const std::string & l_annotation = this->annotation?this->annotation->text:"";
t_ss.add(Proxy_Function
(new dispatch::Dynamic_Proxy_Function(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>,
(new dispatch::Dynamic_Proxy_Function(boost::bind(chaiscript::eval::detail::eval_function,
boost::ref(t_ss), this->children.back(),
t_param_names, _1), static_cast<int>(numparams), this->children.back(),
l_annotation, guard)), l_function_name);
@@ -582,7 +584,7 @@ namespace chaiscript
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) {
bool cond;
detail::Scope_Push_Pop spp(t_ss);
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
try {
cond = boxed_cast<bool>(this->children[0]->eval(t_ss));
@@ -663,7 +665,7 @@ namespace chaiscript
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
bool cond;
detail::Scope_Push_Pop spp(t_ss);
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
try {
if (this->children.size() == 4) {
@@ -845,7 +847,7 @@ namespace chaiscript
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
Boxed_Value retval;
detail::Scope_Push_Pop spp(t_ss);
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
try {
retval = this->children[0]->eval(t_ss);
@@ -1013,7 +1015,7 @@ namespace chaiscript
boost::shared_ptr<dispatch::Dynamic_Proxy_Function> guard;
if (guardnode) {
guard = boost::shared_ptr<dispatch::Dynamic_Proxy_Function>
(new dispatch::Dynamic_Proxy_Function(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>,
(new dispatch::Dynamic_Proxy_Function(boost::bind(chaiscript::eval::detail::eval_function,
boost::ref(t_ss), guardnode,
t_param_names, _1), static_cast<int>(numparams), guardnode));
}
@@ -1025,7 +1027,7 @@ namespace chaiscript
if (function_name == class_name) {
t_ss.add(Proxy_Function
(new dispatch::detail::Dynamic_Object_Constructor(class_name, Proxy_Function
(new dispatch::Dynamic_Proxy_Function(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>,
(new dispatch::Dynamic_Proxy_Function(boost::bind(chaiscript::eval::detail::eval_function,
boost::ref(t_ss), this->children.back(),
t_param_names, _1), static_cast<int>(numparams), this->children.back(),
l_annotation, guard)))), function_name);
@@ -1040,7 +1042,7 @@ namespace chaiscript
}
t_ss.add(Proxy_Function
(new dispatch::detail::Dynamic_Object_Function(class_name, Proxy_Function
(new dispatch::Dynamic_Proxy_Function(boost::bind(&eval_function<chaiscript::detail::Dispatch_Engine>,
(new dispatch::Dynamic_Proxy_Function(boost::bind(chaiscript::eval::detail::eval_function,
boost::ref(t_ss), this->children.back(),
t_param_names, _1), static_cast<int>(numparams), this->children.back(),
l_annotation, guard)), ti)), function_name);

View File

@@ -16,8 +16,10 @@
namespace chaiscript
{
/// \brief Classes and functions used during the parsing process.
namespace parser
{
/// \brief Classes and functions internal to the parsing process. Not supported for the end user.
namespace detail
{
enum Alphabet

View File

@@ -55,6 +55,7 @@
namespace chaiscript
{
/// \brief Classes and functions which provide general utility to the end user.
namespace utility
{
inline std::string class_name_translator(const std::string &t_name)