rename namespace to cubescript
parent
b9b344cba6
commit
21aec59ad3
|
@ -35,7 +35,7 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static_assert(std::is_integral_v<integer_type>, "integer_type must be integral");
|
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");
|
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;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif /* LIBCUBESCRIPT_CUBESCRIPT_HH */
|
#endif /* LIBCUBESCRIPT_CUBESCRIPT_HH */
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
|
#ifndef LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
|
||||||
#define LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
|
#define LIBCUBESCRIPT_CUBESCRIPT_CONF_HH
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
using integer_type = int;
|
using integer_type = int;
|
||||||
using float_type = float;
|
using float_type = float;
|
||||||
|
|
||||||
constexpr auto const INT_FORMAT = "%d";
|
constexpr auto const INT_FORMAT = "%d";
|
||||||
constexpr auto const FLOAT_FORMAT = "%.7g";
|
constexpr auto const FLOAT_FORMAT = "%.7g";
|
||||||
constexpr auto const ROUND_FLOAT_FORMAT = "%.1f";
|
constexpr auto const ROUND_FLOAT_FORMAT = "%.1f";
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif /* LIBCUBESCRIPT_CUBESCRIPT_CONF_HH */
|
#endif /* LIBCUBESCRIPT_CUBESCRIPT_CONF_HH */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "cs_bcode.hh"
|
#include "cs_bcode.hh"
|
||||||
#include "cs_state.hh"
|
#include "cs_state.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
/* public API impls */
|
/* public API impls */
|
||||||
|
|
||||||
|
@ -133,4 +133,4 @@ bcode *bcode_get_empty(empty_block *empty, std::size_t val) {
|
||||||
return &empty[val].init + 1;
|
return &empty[val].init + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
struct bcode {
|
struct bcode {
|
||||||
std::uint32_t init;
|
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);
|
void bcode_free_empty(internal_state *cs, empty_block *empty);
|
||||||
bcode *bcode_get_empty(empty_block *empty, std::size_t val);
|
bcode *bcode_get_empty(empty_block *empty, std::size_t val);
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "cs_vm.hh"
|
#include "cs_vm.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
LIBCUBESCRIPT_EXPORT char *error::request_buf(
|
LIBCUBESCRIPT_EXPORT char *error::request_buf(
|
||||||
state &cs, std::size_t bufs, char *&sp
|
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());
|
return stack_state(cs, ret, total > dalias->get_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
std::string_view codegen_state::get_str() {
|
std::string_view codegen_state::get_str() {
|
||||||
size_t nl;
|
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));
|
code.push_back(BC_INST_EXIT | ((ret_type < VAL_ANY) ? (ret_type << BC_INST_RET) : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
|
@ -3,7 +3,7 @@
|
||||||
#include "cs_bcode.hh"
|
#include "cs_bcode.hh"
|
||||||
#include "cs_vm.hh"
|
#include "cs_vm.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
ident_impl::ident_impl(ident_type tp, string_ref nm, int fl):
|
ident_impl::ident_impl(ident_type tp, string_ref nm, int fl):
|
||||||
p_name{nm}, p_type{int(tp)}, p_flags{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;
|
return static_cast<command_impl const *>(this)->p_numargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <cubescript/cubescript.hh>
|
#include <cubescript/cubescript.hh>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ID_UNKNOWN = -1, ID_IVAR, ID_FVAR, ID_SVAR, ID_COMMAND, ID_ALIAS,
|
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);
|
bool ident_is_used_arg(ident *id, state &cs);
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "cs_std.hh"
|
#include "cs_std.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
/* string/word parsers are also useful to have public */
|
/* 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 */
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
integer_type parse_int(std::string_view input, std::string_view *end = nullptr);
|
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);
|
float_type parse_float(std::string_view input, std::string_view *end = nullptr);
|
||||||
|
|
||||||
bool is_valid_name(std::string_view input);
|
bool is_valid_name(std::string_view input);
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "cs_vm.hh" // FIXME, only Max Arguments
|
#include "cs_vm.hh" // FIXME, only Max Arguments
|
||||||
#include "cs_parser.hh"
|
#include "cs_parser.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
internal_state::internal_state(alloc_func af, void *data):
|
internal_state::internal_state(alloc_func af, void *data):
|
||||||
allocf{af}, aptr{data},
|
allocf{af}, aptr{data},
|
||||||
|
@ -787,4 +787,4 @@ LIBCUBESCRIPT_EXPORT void state::init_libs(int libs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "cs_bcode.hh"
|
#include "cs_bcode.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
struct state;
|
struct state;
|
||||||
struct internal_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);
|
istate->alloc(p, n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "cs_state.hh"
|
#include "cs_state.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
/* run func, call the second one after finishing */
|
/* run func, call the second one after finishing */
|
||||||
|
|
||||||
|
@ -120,6 +120,6 @@ struct charbuf: valbuf<char> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "cs_strman.hh"
|
#include "cs_strman.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
struct string_ref_state {
|
struct string_ref_state {
|
||||||
std::size_t length;
|
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;
|
return p_str == s.p_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "cs_std.hh"
|
#include "cs_std.hh"
|
||||||
#include "cs_state.hh"
|
#include "cs_state.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
struct string_ref_state;
|
struct string_ref_state;
|
||||||
|
|
||||||
|
@ -87,6 +87,6 @@ struct string_pool {
|
||||||
> counts;
|
> counts;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static std::string_view intstr(integer_type v, charbuf &buf) {
|
static std::string_view intstr(integer_type v, charbuf &buf) {
|
||||||
buf.reserve(32);
|
buf.reserve(32);
|
||||||
|
@ -340,7 +340,7 @@ bool any_value::code_is_empty() const {
|
||||||
if (get_type() != value_type::CODE) {
|
if (get_type() != value_type::CODE) {
|
||||||
return true;
|
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 {
|
bool any_value::get_bool() const {
|
||||||
|
@ -454,4 +454,4 @@ LIBCUBESCRIPT_EXPORT string_ref concat_values(
|
||||||
return string_ref{cs, buf.str()};
|
return string_ref{cs, buf.str()};
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static inline bool ident_has_cb(ident *id) {
|
static inline bool ident_has_cb(ident *id) {
|
||||||
if (!id->is_command() && !id->is_special()) {
|
if (!id->is_command() && !id->is_special()) {
|
||||||
|
@ -1517,4 +1517,4 @@ loop_state state::run_loop(bcode *code) {
|
||||||
return run_loop(code, ret);
|
return run_loop(code, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "cs_bcode.hh"
|
#include "cs_bcode.hh"
|
||||||
#include "cs_ident.hh"
|
#include "cs_ident.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static constexpr int MaxArguments = 25;
|
static constexpr int MaxArguments = 25;
|
||||||
static constexpr int MaxResults = 7;
|
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 */
|
#endif /* LIBCUBESCRIPT_VM_HH */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "cs_ident.hh"
|
#include "cs_ident.hh"
|
||||||
#include "cs_vm.hh" // FIXME, only Max Arguments
|
#include "cs_vm.hh" // FIXME, only Max Arguments
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static inline void do_loop(
|
static inline void do_loop(
|
||||||
state &cs, ident &id, integer_type offset, integer_type n, integer_type step,
|
state &cs, ident &id, integer_type offset, integer_type n, integer_type step,
|
||||||
|
@ -341,4 +341,4 @@ end:
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "cs_std.hh"
|
#include "cs_std.hh"
|
||||||
#include "cs_parser.hh"
|
#include "cs_parser.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct arg_val;
|
struct arg_val;
|
||||||
|
@ -642,4 +642,4 @@ static void init_lib_list_sort(state &gcs) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <cubescript/cubescript.hh>
|
#include <cubescript/cubescript.hh>
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
static constexpr float_type PI = 3.14159265358979f;
|
static constexpr float_type PI = 3.14159265358979f;
|
||||||
static constexpr float_type RAD = PI / 180.0f;
|
static constexpr float_type RAD = PI / 180.0f;
|
||||||
|
@ -364,4 +364,4 @@ void init_lib_math(state &cs) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "cs_std.hh"
|
#include "cs_std.hh"
|
||||||
#include "cs_strman.hh"
|
#include "cs_strman.hh"
|
||||||
|
|
||||||
namespace cscript {
|
namespace cubescript {
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
static inline void str_cmp_by(
|
static inline void str_cmp_by(
|
||||||
|
@ -233,4 +233,4 @@ void init_lib_string(state &cs) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace cscript */
|
} /* namespace cubescript */
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <cubescript/cubescript.hh>
|
#include <cubescript/cubescript.hh>
|
||||||
|
|
||||||
namespace cs = cscript;
|
namespace cs = cubescript;
|
||||||
|
|
||||||
std::string_view version = "CubeScript 0.0.1";
|
std::string_view version = "CubeScript 0.0.1";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue