rename namespace to cubescript

master
Daniel Kolesa 2021-03-23 23:32:25 +01:00
parent b9b344cba6
commit 21aec59ad3
23 changed files with 46 additions and 46 deletions

View File

@ -35,7 +35,7 @@
# endif
#endif
namespace cscript {
namespace cubescript {
static_assert(std::is_integral_v<integer_type>, "integer_type must be integral");
static_assert(std::is_signed_v<integer_type>, "integer_type must be signed");
@ -989,6 +989,6 @@ inline R print_stack(R writer, stack_state const &st) {
return writer;
}
} /* namespace cscript */
} /* namespace cubescript */
#endif /* LIBCUBESCRIPT_CUBESCRIPT_HH */

View File

@ -1,13 +1,13 @@
#ifndef LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
#define LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
namespace cscript {
namespace cubescript {
using integer_type = int;
using float_type = float;
constexpr auto const INT_FORMAT = "%d";
constexpr auto const FLOAT_FORMAT = "%.7g";
constexpr auto const ROUND_FLOAT_FORMAT = "%.1f";
} /* namespace cscript */
} /* namespace cubescript */
#endif /* LIBCUBESCRIPT_CUBESCRIPT_CONF_HH */

View File

@ -1,7 +1,7 @@
#include "cs_bcode.hh"
#include "cs_state.hh"
namespace cscript {
namespace cubescript {
/* public API impls */
@ -133,4 +133,4 @@ bcode *bcode_get_empty(empty_block *empty, std::size_t val) {
return &empty[val].init + 1;
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -6,7 +6,7 @@
#include <cstdint>
#include <cstddef>
namespace cscript {
namespace cubescript {
struct bcode {
std::uint32_t init;
@ -88,6 +88,6 @@ empty_block *bcode_init_empty(internal_state *cs);
void bcode_free_empty(internal_state *cs, empty_block *empty);
bcode *bcode_get_empty(empty_block *empty, std::size_t val);
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -2,7 +2,7 @@
#include "cs_vm.hh"
namespace cscript {
namespace cubescript {
LIBCUBESCRIPT_EXPORT char *error::request_buf(
state &cs, std::size_t bufs, char *&sp
@ -80,4 +80,4 @@ LIBCUBESCRIPT_EXPORT stack_state error::save_stack(state &cs) {
return stack_state(cs, ret, total > dalias->get_value());
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -8,7 +8,7 @@
#include <limits>
#include <iterator>
namespace cscript {
namespace cubescript {
std::string_view codegen_state::get_str() {
size_t nl;
@ -1468,4 +1468,4 @@ void codegen_state::gen_main(std::string_view s, int ret_type) {
code.push_back(BC_INST_EXIT | ((ret_type < VAL_ANY) ? (ret_type << BC_INST_RET) : 0));
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -3,7 +3,7 @@
#include "cs_bcode.hh"
#include "cs_vm.hh"
namespace cscript {
namespace cubescript {
ident_impl::ident_impl(ident_type tp, string_ref nm, int fl):
p_name{nm}, p_type{int(tp)}, p_flags{fl}
@ -416,4 +416,4 @@ LIBCUBESCRIPT_EXPORT int command::get_num_args() const {
return static_cast<command_impl const *>(this)->p_numargs;
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -3,7 +3,7 @@
#include <cubescript/cubescript.hh>
namespace cscript {
namespace cubescript {
enum {
ID_UNKNOWN = -1, ID_IVAR, ID_FVAR, ID_SVAR, ID_COMMAND, ID_ALIAS,
@ -114,6 +114,6 @@ struct command_impl: ident_impl, command {
bool ident_is_used_arg(ident *id, state &cs);
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -5,7 +5,7 @@
#include "cs_std.hh"
namespace cscript {
namespace cubescript {
/* string/word parsers are also useful to have public */
@ -425,4 +425,4 @@ LIBCUBESCRIPT_EXPORT void list_parser::skip_until_item() {
}
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -5,13 +5,13 @@
#include <string_view>
namespace cscript {
namespace cubescript {
integer_type parse_int(std::string_view input, std::string_view *end = nullptr);
float_type parse_float(std::string_view input, std::string_view *end = nullptr);
bool is_valid_name(std::string_view input);
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -6,7 +6,7 @@
#include "cs_vm.hh" // FIXME, only Max Arguments
#include "cs_parser.hh"
namespace cscript {
namespace cubescript {
internal_state::internal_state(alloc_func af, void *data):
allocf{af}, aptr{data},
@ -787,4 +787,4 @@ LIBCUBESCRIPT_EXPORT void state::init_libs(int libs) {
}
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -8,7 +8,7 @@
#include "cs_bcode.hh"
namespace cscript {
namespace cubescript {
struct state;
struct internal_state;
@ -111,6 +111,6 @@ inline void std_allocator<T>::deallocate(T *p, std::size_t n) {
istate->alloc(p, n, 0);
}
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -10,7 +10,7 @@
#include "cs_state.hh"
namespace cscript {
namespace cubescript {
/* run func, call the second one after finishing */
@ -120,6 +120,6 @@ struct charbuf: valbuf<char> {
}
};
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -2,7 +2,7 @@
#include "cs_strman.hh"
namespace cscript {
namespace cubescript {
struct string_ref_state {
std::size_t length;
@ -157,4 +157,4 @@ LIBCUBESCRIPT_EXPORT bool string_ref::operator==(string_ref const &s) const {
return p_str == s.p_str;
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -9,7 +9,7 @@
#include "cs_std.hh"
#include "cs_state.hh"
namespace cscript {
namespace cubescript {
struct string_ref_state;
@ -87,6 +87,6 @@ struct string_pool {
> counts;
};
} /* namespace cscript */
} /* namespace cubescript */
#endif

View File

@ -5,7 +5,7 @@
#include <cmath>
namespace cscript {
namespace cubescript {
static std::string_view intstr(integer_type v, charbuf &buf) {
buf.reserve(32);
@ -340,7 +340,7 @@ bool any_value::code_is_empty() const {
if (get_type() != value_type::CODE) {
return true;
}
return cscript::code_is_empty(csv_get<bcode *>(p_stor));
return cubescript::code_is_empty(csv_get<bcode *>(p_stor));
}
bool any_value::get_bool() const {
@ -454,4 +454,4 @@ LIBCUBESCRIPT_EXPORT string_ref concat_values(
return string_ref{cs, buf.str()};
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -6,7 +6,7 @@
#include <cstdio>
#include <limits>
namespace cscript {
namespace cubescript {
static inline bool ident_has_cb(ident *id) {
if (!id->is_command() && !id->is_special()) {
@ -1517,4 +1517,4 @@ loop_state state::run_loop(bcode *code) {
return run_loop(code, ret);
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -12,7 +12,7 @@
#include "cs_bcode.hh"
#include "cs_ident.hh"
namespace cscript {
namespace cubescript {
static constexpr int MaxArguments = 25;
static constexpr int MaxResults = 7;
@ -225,6 +225,6 @@ static void call_with_args(state &cs, F body) {
});
}
} /* namespace cscript */
} /* namespace cubescript */
#endif /* LIBCUBESCRIPT_VM_HH */

View File

@ -4,7 +4,7 @@
#include "cs_ident.hh"
#include "cs_vm.hh" // FIXME, only Max Arguments
namespace cscript {
namespace cubescript {
static inline void do_loop(
state &cs, ident &id, integer_type offset, integer_type n, integer_type step,
@ -341,4 +341,4 @@ end:
});
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -5,7 +5,7 @@
#include "cs_std.hh"
#include "cs_parser.hh"
namespace cscript {
namespace cubescript {
template<typename T>
struct arg_val;
@ -642,4 +642,4 @@ static void init_lib_list_sort(state &gcs) {
});
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -6,7 +6,7 @@
#include <cubescript/cubescript.hh>
namespace cscript {
namespace cubescript {
static constexpr float_type PI = 3.14159265358979f;
static constexpr float_type RAD = PI / 180.0f;
@ -364,4 +364,4 @@ void init_lib_math(state &cs) {
});
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -6,7 +6,7 @@
#include "cs_std.hh"
#include "cs_strman.hh"
namespace cscript {
namespace cubescript {
template<typename F>
static inline void str_cmp_by(
@ -233,4 +233,4 @@ void init_lib_string(state &cs) {
});
}
} /* namespace cscript */
} /* namespace cubescript */

View File

@ -9,7 +9,7 @@
#include <cubescript/cubescript.hh>
namespace cs = cscript;
namespace cs = cubescript;
std::string_view version = "CubeScript 0.0.1";