History

Remove 'using namespace' statements from all but the execution table file.

arr committed 9 years ago

Commit 2519a931 parent 68d4d6931 files · +725 −426Browse files

Showing the changes to src/vm/string.cpp (1 of 31 files). Show all

Unified · Split

src/vm/string.cpp+24−19
@@ -11,8 +11,13 @@ · 10 unmodified lines
1111 #include <debug.h>
1212 #include <exceptions.h>
1313
14−using namespace disvm;
15−using namespace disvm::runtime;
14+using disvm::debug::component_trace_t;
15+using disvm::debug::log_level_t;
16+
17+using disvm::runtime::intrinsic_type_desc;
18+using disvm::runtime::type_descriptor_t;
19+using disvm::runtime::vm_string_t;
20+using disvm::runtime::word_t;
1621
1722 std::shared_ptr<const type_descriptor_t> vm_string_t::type_desc()
1823 {
@@ -47,8 +52,8 @@ namespace · 28 unmodified lines
4752 {
4853 for (auto i = word_t{ 0 }; i < len; ++i)
4954 {
50− const auto sc1 = static_cast<runtime::rune_t>(s1[i]);
51− const auto sc2 = static_cast<runtime::rune_t>(s2[i]);
55+ const auto sc1 = static_cast<disvm::runtime::rune_t>(s1[i]);
56+ const auto sc2 = static_cast<disvm::runtime::rune_t>(s2[i]);
5257
5358 if (sc1 != sc2)
5459 return (sc1 < sc2) ? (-1) : 1;
@@ -128,10 +133,10 @@ namespace · 73 unmodified lines
128133 }
129134
130135 template<>
131− void copy_characters_to(runtime::rune_t *dest, word_t dest_start, const runtime::rune_t *source, word_t source_length)
136+ void copy_characters_to(disvm::runtime::rune_t *dest, word_t dest_start, const disvm::runtime::rune_t *source, word_t source_length)
132137 {
133138 assert(dest != nullptr && source != nullptr && dest != source);
134− std::memcpy((dest + dest_start), source, (source_length * sizeof(runtime::rune_t)));
139+ std::memcpy((dest + dest_start), source, (source_length * sizeof(disvm::runtime::rune_t)));
135140 }
136141
137142 void combine(
@@ -146,14 +151,14 @@ namespace · 8 unmodified lines
146151 {
147152 if (dest_is_rune)
148153 {
149− auto dest_rune = reinterpret_cast<runtime::rune_t *>(dest);
154+ auto dest_rune = reinterpret_cast<disvm::runtime::rune_t *>(dest);
150155 if (source1_is_rune)
151− copy_characters_to(dest_rune, 0, reinterpret_cast<const runtime::rune_t *>(source1), source1_length);
156+ copy_characters_to(dest_rune, 0, reinterpret_cast<const disvm::runtime::rune_t *>(source1), source1_length);
152157 else
153158 copy_characters_to(dest_rune, 0, source1, source1_length);
154159
155160 if (source2_is_rune)
156− copy_characters_to(dest_rune, source1_length, reinterpret_cast<const runtime::rune_t *>(source2), source2_length);
161+ copy_characters_to(dest_rune, source1_length, reinterpret_cast<const disvm::runtime::rune_t *>(source2), source2_length);
157162 else
158163 copy_characters_to(dest_rune, source1_length, source2, source2_length);
159164 }
@@ -235,8 +240,8 @@ vm_string_t::vm_string_t(std::size_t encoded_str_len, const uint8_t *encoded_str · 75 unmodified lines
235240 encoded_str += utf8::decode(encoded_str, rune_dest[i]);
236241 }
237242
238− if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
239− debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm string: %d %d >>%s<<", _length, (_length_max * _character_size), dest);
243+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::memory>())
244+ disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "init: vm string: %d %d >>%s<<", _length, (_length_max * _character_size), dest);
240245 }
241246
242247 vm_string_t::vm_string_t(const vm_string_t &s1, const vm_string_t &s2)
@@ -297,8 +302,8 @@ vm_string_t::vm_string_t(const vm_string_t &other, word_t begin_index, word_t en · 54 unmodified lines
297302 const auto length_in_bytes = _length * _character_size;
298303 std::memcpy(dest, (src + (begin_index * _character_size)), length_in_bytes);
299304
300− if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
301− debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "copy: vm string: %#" PRIxPTR " %d %d %#" PRIxPTR, &other, begin_index, end_index, this);
305+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::memory>())
306+ disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "copy: vm string: %#" PRIxPTR " %d %d %#" PRIxPTR, &other, begin_index, end_index, this);
302307 }
303308
304309 vm_string_t::~vm_string_t()
@@ -314,8 +319,8 @@ vm_string_t::~vm_string_t() · 9 unmodified lines
314319 debug::assign_debug_pointer(&source);
315320 debug::assign_debug_pointer(&_encoded_str);
316321
317− if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
318− debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm string");
322+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::memory>())
323+ disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "destroy: vm string");
319324 }
320325
321326 vm_string_t &vm_string_t::append(const vm_string_t &other)
@@ -389,7 +394,7 @@ word_t vm_string_t::get_length() const · 67 unmodified lines
389394 return _length;
390395 }
391396
392−runtime::rune_t vm_string_t::get_rune(word_t index) const
397+disvm::runtime::rune_t vm_string_t::get_rune(word_t index) const
393398 {
394399 if (index < 0 || _length <= index)
395400 throw index_out_of_range_memory{ 0, _length - 1, index };
@@ -401,12 +406,12 @@ runtime::rune_t vm_string_t::get_rune(word_t index) const · 5 unmodified lines
401406
402407 // Check if multi-byte or ASCII
403408 if (_character_size != sizeof(char))
404− return reinterpret_cast<const rune_t *>(source)[index];
409+ return reinterpret_cast<const disvm::runtime::rune_t *>(source)[index];
405410 else
406− return static_cast<const rune_t>(source[index]);
411+ return static_cast<const disvm::runtime::rune_t>(source[index]);
407412 }
408413
409−void vm_string_t::set_rune(word_t index, rune_t value)
414+void vm_string_t::set_rune(word_t index, disvm::runtime::rune_t value)
410415 {
411416 // This function does not adhere to the immutable string contract.
412417 // Therefore, it is unsafe to call this function if there is more